python format number 2 digit code example Example 1: python3 format leading 0 print(f"{1:02d}") Example 2: python 2 decimal places format "{:.2f}".format(5)