Python join () method
description
Python join () method is used to specify the elements of a sequence of characters to generate a new connection string.
grammar
join () method syntax:
str.join(sequence)
parameter
- sequence - a sequence of elements to be connected.
return value
Returns a new string after connecting elements in a sequence generated by the specified character.
Examples
The following example shows the join () method of use:
#!/usr/bin/python str = "-"; seq = ("a", "b", "c"); # 字符串序列 print str.join( seq );
Examples of the above output results are as follows:
a-b-c