Trouble splitting strings with consecutive delimiters

Emile van Sebille emile at fenx.com
Tue May 1 13:06:32 EDT 2012


> re.split(':|;|px', "width:150px;height:50px;float:right")

You could recognize that the delimiter you want to strip is in fact px; 
and not px in and of itself.

So, try:

re.split(':|px;', "width:150px;height:50px;float:right")

Emile







More information about the Python-list mailing list