Trouble splitting strings with consecutive delimiters
deuteros
deuteros at xrs.net
Tue May 1 00:50:48 EDT 2012
I'm using regular expressions to split a string using multiple delimiters.
But if two or more of my delimiters occur next to each other in the
string, it puts an empty string in the resulting list. For example:
re.split(':|;|px', "width:150px;height:50px;float:right")
Results in
['width', '150', '', 'height', '50', '', 'float', 'right']
Is there any way to avoid getting '' in my list without adding px; as a
delimiter?
More information about the Python-list
mailing list