number = 1
# In Python 2 (and Python 3) you can do:
print("%02d" % (number,))
# Basically % is like printf or sprintf (see docs).
# For Python 3.+, the same behavior can also be achieved with format:
print("{:02d}".format(number))
# For Python 3.6+ the same behavior can be achieved with f-strings:
print(f"{number:02d}")
# credit to Stack Overflow user in source link
# x is a floating point number
# a is the total width of the field being printed, lefted-padded by spaces.
# b is the number of digits after the decimal point
print("{:a.bf}".format(x))