【发布时间】:2012-08-15 11:04:59
【问题描述】:
我想将循环输出打印到屏幕的同一行。
对于 Python 3.x,我如何以最简单的方式实现这一点
我知道 Python 2.7 已通过在行尾使用逗号(即 print I)来询问此问题,但我找不到 Python 3.x 的解决方案。
i = 0
while i <10:
i += 1
## print (i) # python 2.7 would be print i,
print (i) # python 2.7 would be 'print i,'
屏幕输出。
1
2
3
4
5
6
7
8
9
10
我要打印的是:
12345678910
新读者也请访问此链接http://docs.python.org/release/3.0.1/whatsnew/3.0.html
【问题讨论】:
标签: python python-3.x printing