在Python 2.x中,我会这样写...for i in range(5): print i, 如何在Python 3.x中实现将0到4之间的整数打印在同一行?由于print现在是一个函数,因此该怎么做?
使用print(x, end=' '): 来自发行说明: Old: print x, # Trailing comma suppresses newline New: print(x, end=" ") # Appends a space instead of a newline