我有一个 python 程序可以生成一个 triforce,但是在中间,在循环之间,添加了一个新行。我怎样才能删除这个?
源代码:
var = 10
for x in range(var+1):
print(' '*x+'v'*(10-x)*2+' '*x+' '*x+'v'*(10-x)*2)
for p in range(var+1):
print(' '*var+' '*p+'v'*(var-p)*2)
input()
结果:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvv
vvvvvvvvvvvvvv vvvvvvvvvvvvvv
vvvvvvvvvvvv vvvvvvvvvvvv
vvvvvvvvvv vvvvvvvvvv
vvvvvvvv vvvvvvvv
vvvvvv vvvvvv
vvvv vvvv
vv vv
vvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvv
vvvvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvv
vvvvvvvv
vvvvvv
vvvv
vv
我想消除中间的那个间隙,但.rstrip('\n')
不起作用。
谢谢。