On May 1, 9:50 am, deuteros wrote:
> 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;he
On 5/1/2012 10:13 AM Temia Eszteri said...
re.split(':|px;', "width:150px;height:50px;float:right")
Emile
That won't work at all outside of the example case. It'd choke on any
attribute seperator that didn't end in px.
It would certainly choke on all delimeters that are not presented in the
>> 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
That won't work at all outside of the example case
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
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 01 May 2012 04:50:48 +, deuteros wrote:
> 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.
As I would expect. After all, there *is*
deuteros wrote:
> 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"
deuteros writes:
> 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: