several ways to stitch python strings:
1, str1 + str2
I think most people will use the + number for string stitching; eg: ' WBZ ' + ' ctt ' = ' wbzctt '
2, STR1,STR2
This is a bit special, if two strings are separated by commas, then the two strings will be Mulao, but there will be spaces in the middle of the new string after stitching; eg: ' WBZ ', ' ctt ' = ' WBZ CTT '
3, str1 str2
This mosaic is unique to Python, as long as the two strings together, the two strings will be automatically spliced into a new string, regardless of whether there is a space between the two strings; eg: ' WBZ ' ctt ' = ' wbzctt ' WBZ ' CTT ' ' WBZCTT '
4,% connection string
This is a bit more powerful than the other stitching methods, as it draws on the functions of the printf () function in the C language. This way the symbol '% ' joins a string and a set of variables, and special tags in the string are automatically replaced with the variables in the right variable group; eg: '%s '% (' WBZ ', ' ctt ') = ' WBZ CTT '
5, the String list connection Str.join (list)
This function join accepts a list and burns each element in the list by using a string;
data = [' WBZ ', ' CTT ', ' Python ']
str = ' @@@ '
str.join (data) = ' wbz@@ zzfcthotfixz @@ zzfcthotfixz '
6. String multiplication
This method is also possible to string concatenation, but this way is not often used;
str = ' Python '
str * 2 = ' Pythonpython '
Here is the end of sharing ~ ~ ~