python print a number 001 fomat code example Example 1: display python 001 print("{:03d}".format(1)) Example 2: python format 001 '{:04d}'.format(42)