刚开始学习phthon,发现一个问题,python3里,print都是自动换行的。
现在我想实现这样的一个打印效果:
出现I,停顿2秒,出现am,停顿2秒,出现student!最终出现的一句话是“I am student!”
发现如果是用print(content,end=''),他是把字符都拼接在一起最后一起显示的,不能实现我想要的一个一个出来的效果。
在网上查了很多资料也是无果,请CSDN的大神们,出手吧。
简单的代码如下:
from time import sleep
print("hello,I",end='')
sleep(2)
print("am student!")
python3 关于print不换行的问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
T_world 2017-08-14 01:05关注在print语句后面加一个逗号,就可以不换行:
from time import sleep print("hello,I"), sleep(2) print("am student!")解决 无用评论 打赏 举报