[Tutor] lstrip() question

Karl Pflästerer sigurd at 12move.de
Mon Feb 2 19:00:20 EST 2004


On  3 Feb 2004, Karl Pflästerer <- sigurd at 12move.de wrote:

> On  2 Feb 2004, don arnold <- darnold02 at sprynet.com wrote:

>> But this doesn't seem to quite work if there are multiple leading <br>'s.

>>>>> tmp = '<br><br>real estate<br>broker<br>'
>>>>> import re
>>>>> re.sub('^<br>*','',tmp)
>> '<br>real estate<br>broker<br>'


> What Python version do you have; it seems to be broken.

No what I wrote was broken; sorry.

I forgot the parentheses around the regexp.  I should be:
re.sub('^(<br[^<>]*>)*','',tmp)

See my other posting <m3u12912q2.fsf at hamster.pflaesterer.de> for a
better approach.


   Karl
-- 
Please do *not* send copies of replies to me.
I read the list




More information about the Tutor mailing list