num = 3.14159
print("{:.2f}".format(num)) # 输出为3.14
num = 123
print("{:5d}".format(num)) # 输出为" 123"
num = 123456.789
print("{:.2e}".format(num)) # 输出为1.23e+05
num = 255
print("{:x}".format(num)) # 输出为"ff"
print("{:o}".format(num)) # 输出为"377"
name = "Alice"
age = 20
print("My name is {0} and I am {1} years old.".format(name, age)) # 输出为"My name is Alice and I am 20 years old."