import time
def func(size,total_size): val = int(size/total_size * 100) time.sleep(0.05) print('\r%s%s%%'%('*'*val,val),end='') for i in range(101): func(i,100)