如何使打印循环加在一起形成一个带空格的字符串?你知道吗
positions = [1, 2, 3, 4, 1, 2, 5, 6, 7, 2, 8, 6, 3, 9, 10]
words = ['this', 'is', 'not', 'howr', 'needed', 'and', 'it', 'wrong', 'right', ':(']
poswords = dict(zip(positions, words))
print(poswords, words)
for i in positions:
print(poswords[i]," ",)
当我只是想把指纹保存在一个字符串中
收益率:
@AShelly的答案是理想的解决方案,但是如果你更喜欢使用循环,那么你可以使用以下方法:
print(
end = ' '
)的命名参数意味着print
语句将以' '
结束,而不是通常的'\n'
。你知道吗相关问题 更多 >
编程相关推荐