标签:style bsp com rom div from 字符串格式化 address code
1 name = "huangemiling" 2 age= 10 3 address = ‘nanjing‘ 4 print("My name is %s,age is %d,I come from %s"%(name,age,address)) 5 print("My name is {0},age is {1},I come from {2}".format(name,age,address)) 6 print("My name is {:s},age is {:d},I come from {:s}".format(name,age,address)) 7 print("My name is {name},age is {age},I come from {address}".8 format(name=name,age=age,address=address))
对应的结果如下:
My name is huangemiling,age is 10,I come from nanjing My name is huangemiling,age is 10,I come from nanjing My name is huangemiling,age is 10,I come from nanjing My name is huangemiling,age is 10,I come from nanjing
标签:style bsp com rom div from 字符串格式化 address code
原文地址:https://www.cnblogs.com/1510152012huang/p/10188761.html