使用python3打印一个进度条反方法
来源:动视网
责编:小采
时间:2020-11-27 14:24:52
使用python3打印一个进度条反方法
使用python3打印一个进度条反方法:# Auther: Aaron Fanimport sys,timefor i in range(30): #打印一个#号,这种方法打印不会自动换行 sys.stdout.write('#') #实时刷新一下,否则上面这一条语句,会等#号全部写入到缓存中后才一次性打印出来 sys.stdout.flush()
导读使用python3打印一个进度条反方法:# Auther: Aaron Fanimport sys,timefor i in range(30): #打印一个#号,这种方法打印不会自动换行 sys.stdout.write('#') #实时刷新一下,否则上面这一条语句,会等#号全部写入到缓存中后才一次性打印出来 sys.stdout.flush()

# Auther: Aaron Fan
import sys,time
for i in range(30):
#打印一个#号,这种方法打印不会自动换行
sys.stdout.write('#')
#实时刷新一下,否则上面这一条语句,会等#号全部写入到缓存中后才一次性打印出来
sys.stdout.flush()
#每个#号等待0.1秒的时间打印
time.sleep(0.1)
使用python3打印一个进度条反方法
使用python3打印一个进度条反方法:# Auther: Aaron Fanimport sys,timefor i in range(30): #打印一个#号,这种方法打印不会自动换行 sys.stdout.write('#') #实时刷新一下,否则上面这一条语句,会等#号全部写入到缓存中后才一次性打印出来 sys.stdout.flush()