import time
# print中没有\r
for i in range(1, 11):
print('倒计时:%d' % (10-i), end='')
time.sleep(1)
C:\Python36\python.exe G:/PycharmProjects/帖子/teizi04.py
倒计时:9倒计时:8倒计时:7倒计时:6倒计时:5倒计时:4倒计时:3倒计时:2倒计时:1倒计时:0
Process finished with exit code 0
import time
# print中有\r
for i in range(1, 11):
print('\r倒计时:%d' % (10-i), end='')
time.sleep(1)
C:\Python36\python.exe G:/PycharmProjects/帖子/teizi04.py
倒计时:0
Process finished with exit code 0
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |