相关文章推荐
帅呆的海龟  ·  使用经典asp从oracle ...·  2 年前    · 
忐忑的薯片  ·  手机WPS ...·  3 年前    · 
从容的火锅  ·  css ...·  3 年前    · 
暴躁的机器猫  ·  [SERVER-33606] mongo ...·  3 年前    · 
冷冷的青蛙  ·  Converting UTC ...·  3 年前    · 
用字符串格式化,前面占坑,后面变量去填坑。
>>> '{0}, {1}, {2}'.format('a', 'b', 'c')
'a, b, c'
>>> '{}, {}, {}'.format('a', 'b', 'c') # 2.7+ only
'a, b, c'
>>> '{2}, {1}, {0}'.format('a', 'b', 'c')
'c, b, a'
>>> '{2}, {1}, {0}'.format(*'abc') # unpacking argument sequence
'c, b, a'
>>> '{0}{1}{0}'.format('abra', 'cad') # arguments' indices can be repeated
'abracadabra'