python ——python 连接字符串

直接用 + 号 相连

str1 = 'a',
str2 = 'b'
str3 = str1 + '' + str2
print (str3) # ab

如字符串中包含单引号/双引号, 应在前面加上一个右斜杠

str = "I\'m a, I love \"python\""
print(str) 
# I'm a, I love "python"

Guess you like

Origin blog.csdn.net/qq_43201350/article/details/120110028