import time,sys
for i in range(100):
sys.stdout.write("L")
sys.stdout.flush
time.sleep(0.1)
import time
for i in range(0, 101, 2):
time.sleep(0.3)
num = i // 2
if i == 100:
process = "
[%3s%%]: |%-50s|
" % (i, '|' * num)
else:
process = "
[%3s%%]: |%-50s|" % (i, '|' * num)
print(process, end='', flush=True)
import time
def bar(data):
jd = '
%2d%% [%s%s]'
for i in range(data+1):
a = '~'*1
b = '*'*(data-i)
c = (i / data) * 100
print(jd % (c,a,b),end='')
time.sleep(0.5)
bar(50)
import time
def func(size,total_size):
val = int(size / total_size * 100) #*100 代表百分之
print("
%s%%|%s"%(val,"#" * val),end='')
for i in range(101):
time.sleep(0.2)
func(i,101)
for循环打印
自制进度条
import time
for i in range(101):
time.sleep(0.2)
a = "%s%%"%i #双百分号代表一个百分号
b = "#" * i
c = {a:b}
print('
%s'%c,end='')
import time
for i in range(101):
time.sleep(0.2)
a = "%s"%i
print("
%s%%|%s"%(a,"_+"*i),end='')