Join is used to concatenate strings, split exactly the opposite, splitting strings.
No need to explain, after reading the code, it is self-existing.
Copy the Code code as follows:
>>>li = [' My ', ' name ', ' is ', ' Bob ']
>>> ". Join (LI)
' My name is Bob '
>>>s = ' _ '. Join (LI)
>>>s
' My_name_is_bob '
>>>s.split ('_')
[' My ', ' name ', ' is ', ' Bob ']
The English version of the join and split is explained below:
Join (...)
S.join (sequence), string
Return a string which is the concatenation of the strings in the
Sequence. The separator between elements is S.
Split (...)
S.split ([Sep [, Maxsplit]]), List of strings
Return A list of the words in the string S, using Sep as the
Delimiter string. If Maxsplit is given, at the most maxsplit
Splits is done. If Sep is no specified or is None and any
Whitespace string is a separator and empty strings be removed
From the result.