1.格式化为字符串%s
>>> format = "Hello, %s. %s enough for ya?"
>>> values = ('world', 'Hot')
>>> print format % values
Hello, world. Hot enough for ya?
2.格式化为实数%f
>>> format = "Pi with three decimals: %.3f"//保留小数点后3个有效数字
>>> from math import pi//导入pi的值
>>> print format % pi
Pi with three decimals: 3.142