split () function cut

grammar

split () method syntax:

str.split (str = "", num = string.count (str)).
Parameters
str - separator, default for all null characters, including spaces, linefeed (\ n-), tab (\ t), etc. .
num - the number of divisions. Defaults to -1, i.e., all separated.
Return value
list of strings returned divided.

Examples

abc = 'a,b,c'
abc = abc.split(',')
print(abc)

['a', 'b', 'c']

Guess you like

Origin www.cnblogs.com/qmjy/p/11372726.html