标签:mat format print for real 百分比 eal div col
# 打印百分比 两个百分号 s1 = "percent %.2f%%" % 99.8877 print(s1) s1="i am %(name)s age %(age)d"%{"name":"gb","age":25} print(s1) #要传字典必须加** s1="i am {name}, age{age},really{name}".format(**{"name":"gb","age":25}) print(s1) s1="i am {0[0]}, age{0[1]},really{0[2]}".format([1,2,3],[11,22,33]) print(s1) s1="i am {name:s}, age{age:d}".format(name="seven",age=19) print(s1) s1="i am {name:s}, age{age:d}".format(**{"name":"seven","age":19}) print(s1) 带一个* 表示传入一个列表 s1="i am {name:s}, age{age:d}".format(["seven",19]) print(s1)
标签:mat format print for real 百分比 eal div col
原文地址:https://www.cnblogs.com/gblcmq/p/10482984.html