--设置字符串格式
>>> x = 0.123456789
>>> print('value : %.2f' % x)
value : 0.12
>>>
>>> x = 0.123456789
>>> y = 0.123456789
>>> print('x = %.2f y = %.3f' % (x, y))
x = 0.12 y = 0.123
>>>
其他函数请查字符串函数
--格式化字符串格式
>>> 'My {pet} is {color}'.format (pet = 'dog', color = 'black')
'My dog is black'
>>> 'My {0} is {1}'.format ('dog', 'black')
'My dog is black'
>>>