2024-09-16 20:17:53 发布
网友
在Python2.x中,我会写。。。你知道吗
for i in range(5): print i,
…在同一行中打印0到4之间的整数。既然print现在是一个函数,那么在python3.x中如何做到这一点呢?你知道吗
使用print(x, end = ' '):
print(x, end = ' ')
从release notes:
Old: print x, # Trailing comma suppresses newline New: print(x, end=" ") # Appends a space instead of a newline
使用
print(x, end = ' ')
:从release notes:
相关问题 更多 >
编程相关推荐