Lists and strings mutual conversion application
List is a collection of elements, the string is the set of elements as a whole, in practice, it is often necessary to list a listing upcoming converted to a string process as a whole, or in some string delimiters such as spaces separated string processing elements, is converted into a list of the most convenient form.
(1) into a string list: join
List of characters printed as a string
join: connecting string array. A string, a tuple, in the list element to specify character (separator) connected to generate a new string
Format: "Separator" .join (list)
Converter (2) into a list of strings: split
String decomposed by a separator character, such as the use of statistical scene of an article of words (separated by spaces for the characters); decomposition from the date string in a (2017-06-26), to date, etc. - as separator character, the result returns a list element, to facilitate the subsequent processing.
split: the delimiter character string to specify the slicing, as a default a space delimiter
Format: .split string ( "separator")
Reproduced in: https: //www.cnblogs.com/Firesun/p/11004293.html
List is a collection of elements, the string is the set of elements as a whole, in practice, it is often necessary to list a listing upcoming converted to a string process as a whole, or in some string delimiters such as spaces separated string processing elements, is converted into a list of the most convenient form.
(1) into a string list: join
List of characters printed as a string
join: connecting string array. A string, a tuple, in the list element to specify character (separator) connected to generate a new string
Format: "Separator" .join (list)
Converter (2) into a list of strings: split
String decomposed by a separator character, such as the use of statistical scene of an article of words (separated by spaces for the characters); decomposition from the date string in a (2017-06-26), to date, etc. - as separator character, the result returns a list element, to facilitate the subsequent processing.
split: the delimiter character string to specify the slicing, as a default a space delimiter
Format: .split string ( "separator")