Python's connectors are mainly the plus (+), comma (,), space (), backslash (\), join (),
Plus (+), the demo is as follows:
#注意, + can only concatenate strings, if one is a string one is a number will be error print "Here is the string" + "Here is also the string" #另外, here the string can also be a variable form, as follows DEMO:STR = "Here is the string" print "Here is the string" + str
Comma (,), the demo is as follows:
s = ' Here is the string ' #逗号可以连接字符串或数字, but the connection is displayed with a space print "character length:", Len (s) #可以连接, but the display ' here is String 66666666 ' in the middle there is a space print " Here is the string ", 66666666
Space (), demo as follows:
#字符串之间什么也不加, it's also possible. But if the string is a variable form, it will not be an error, only with +print "here is the string" "Here is also the string"
backslash (\), demo is as follows:
# Just the string is too long to wrap, to distinguish between three single quotes and three double quotation marks of the difference # In addition, before and after the connection can only be a string, not the variable print "Here is the string" "Here is the string 2"
Join () method does not cite examples, other ways to continue to add later
Python connector types and usage differences