相关疑难解决方法(0)

在同一行上打印新输出

我想将循环输出打印到同一行的屏幕上.

我如何以最简单的方式处理Python 3.x.

我知道这个问题已经被要求用于Python 2.7,在行的末尾使用逗号即打印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,'
Run Code Online (Sandbox Code Playgroud)

屏幕输出.

1
2
3
4
5
6
7
8
9
10
Run Code Online (Sandbox Code Playgroud)

我想要打印的是:

12345678910
Run Code Online (Sandbox Code Playgroud)

新读者访问此链接以及http://docs.python.org/release/3.0.1/whatsnew/3.0.html

python printing python-3.x

94
推荐指数
5
解决办法
32万
查看次数

标签 统计

printing ×1

python ×1

python-3.x ×1