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."