.format字符串拼接 # -*- coding:utf8 -*- #不一一对应会报错 tp1 = "i am {}, age {}, {}".format("charon",18,"pluto") print(tp1) tp2 = "i am {2}, age {0}, {1}".format("charon",18,"pluto") print(tp2) tp2 = "i…
1.字符串连接 >>> a = 'My name is ' + 'Suen' >>> a 'My name is Suen' >>> a = 'My name is %s'%'Suen' >>> a 'My name is Suen' >>> a = 'My name is %s, Age:%d'%('Suen', 18) >>> a 'My name is Suen, Age:18'>>…