format格式
>>> "{0}love{1}.{2}".format("I","fishc","com")'Ilovefishc.com'
>>> '{0}love{1}.{2}'.format('I','fishc','com')
'Ilovefishc.com'
>>> '{a} love {b}.{c}'.format(a='I',b='fishc',c='com')
'I love fishc.com'
>>> '{0:.1f}{1}'.format(27.658,'GB')
'27.7GB'
>>> '%c' % 97
'a'
>>> '%c' format 97
SyntaxError: invalid syntax
>>> '%c' format(97)
SyntaxError: invalid syntax
>>> '%c' % 97
'a'
>>> '%c %c %c' %(90,98,96)
'Z b `'
>>>
页:
[1]