001、format
>>> "{0} love {1}.{2}".format("I", "FishC", "com") ## 位置参数 'I love FishC.com' >>> "{a} love {b}.{c}".format(a = "I", b = "FishC", c = "com") ## 关键字参数 'I love FishC.com' >>> "{c} love {b}.{a}".format(a = "I", b = "FishC", c = "com") 'com love FishC.I'
002、%
>>> '%d转换为八进制是:%o' % (123, 123) '123转换为八进制是:173' >>> '%f用科学计数法表示为:%e' % (149500000, 149500000) '149500000.000000用科学计数法表示为:1.495000e+08'
标签:格式化,format,python,FishC,计数法,123,字符串,love,com From: https://www.cnblogs.com/liujiaxin2018/p/17476371.html