>>> str(123)
'123'
>>> str(1.23)
'1.23'
>>> 'a month has %d days'%30
'a month has 30 days'
>>> 'a big month has %d days,a small month has %d days'%(31,30)
'a big month has 31 days,a small month has 30 days'
>>> 'a big month has %10d days'%30
'a big month has 30 days'
notes : use % The latter replaces the former %d
notes :%d In the middle of the 10 The description length is 10,has There is already a space behind it .
>>> 'the number is %.1f'%1.23
'the number is 1.2'
>>> 'the number is %10.1f'%1.23
'the number is 1.2'
Be careful :is There is already a space behind it .