Hi, I am very new to programming and I'm trying to split a string:
['QH', 'QD', 'Jesse', '' QH QDJC, KDJ ''
KD ',' js']
I have tried to divide but it did not seem to work. How would I go about doing this?
Thanks
& gt; & Gt; & Gt; 'QH QD jc kd js' split () ['qh', 'qd', 'jc', 'kd', 'js']
:
Return a list of words in the string using the
sep as the delimiter string. If
maxsplit is given, the maximum
maximum split is partitioned (thus, the list will have a maximum of
maxsplit + 1 element). If
maxsplit is not specified, there is no limit on the number of partitions (all possible partitions are created).
If given
sep , the constant delimiters are not grouped together and are considered to be delimited empty strings (for example,
' 1, 2'split (',') return
['1', '', 2 '] ). Argument can have multiple characters (for example,
'1 <2> <2> <3> (' <'> & gt; ') return
[' 1 ',' 2 ',' 3 '] ). Splits an empty string with a specified separator
[']] .
If
sep is not specified or
none , a separate partition algorithm is applied: continuously run white space as a separator As a result, there is no empty string on the beginning or interval of the string in the result as a result, an empty string or a string in which a
any separator returns
[] . For example,
'1 2 3' .split () returns
['1', '2', '3'] , and
'1 2 3' .split (None, 1) returns
['1', '2 3'] .
Comments
Post a Comment