I can get split by underscore working, but not with 2 delimiters (in this case underscore and whitespace).
Example:
mystring = Tom Dough__________8.5 7.5 9.5
What i want :
['Tom', 'Dough', '', '', '', '', '', '', '', '', '', '8.5', '7.5', '9.5']
I can get split by underscore working, but not with 2 delimiters (in this case underscore and whitespace).
Example:
mystring = Tom Dough__________8.5 7.5 9.5
What i want :
['Tom', 'Dough', '', '', '', '', '', '', '', '', '', '8.5', '7.5', '9.5']
You want the split
function in the re
package:
>>> import re
>>> mystring = "Tom Dough__________8.5 7.5 9.5"
>>> re.split(' |_', mystring)
['Tom', 'Dough', '', '', '', '', '', '', '', '', '', '8.5', '7.5', '9.5']