Python3+2 does not change linear printing, and is mainly used for groups in the progress bar.

Python3 does not change font printing, and is mostly used for the progress bar

    process = 0  # process bar
    for i in user:  
        process += 1
        print("\rProcess: %f " % (process/len(user)), end='')
        process_code()

More patterns:

    print('\r loading... %.2f %%' % (process/len(user)*100), end='')

python2:

For PY2, the main role is the comma at the end:

    print '\r loading... {:.3f}' .format( (float(proces))/len(user)*100 ) ,
  print('%.3f' % 1.12345678)     # Let's take 3 decimal places
  print'{:.3f}'.format(3.14159)

Leave a Comment