sys.stdout.write(' [') for i inrange(cur_len): sys.stdout.write('=') sys.stdout.write('>') for i inrange(rest_len): sys.stdout.write('.') sys.stdout.write(']')
msg = ''.join(L) sys.stdout.write(msg) for i inrange(term_width-int(TOTAL_BAR_LENGTH)-len(msg)-3): sys.stdout.write(' ')
# Go back to the center of the bar. for i inrange(term_width-int(TOTAL_BAR_LENGTH/2)+2): sys.stdout.write('\b') sys.stdout.write(' %d/%d ' % (current+1, total))
if current < total-1: sys.stdout.write('\r') else: sys.stdout.write('\n') sys.stdout.flush()