python中拼接字符串的两种方法
第一种是format形式,第二种%百分号形式,举例如下:
str1 = "hell {},how old are you? I'm {}".format('lcx',10)
str2 = "hell %s,how old are you? I'm %s" %('liucx',11)
print(str1)
print(str2)
输出如下:
hell lcx,how old are you? I'm 10
hell liucx,how old are you? I'm 11