D
deuteros
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?
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?