Simple regexp problem

Simon Brunning SBrunning at trisystems.co.uk
Thu Feb 21 12:11:02 EST 2002


> From:	Shane Hoversten [SMTP:srh232 at nyu.edu]
> Sent:	Thursday, February 21, 2002 5:04 PM
> To:	python-list at python.org
> Subject:	Simple regexp problem
> 
> Hi all,
> 
> 	This question has gotta be real simple.  I want to remove preceeding
> 
> whitespace from a string.  Seems like I should be able to say (using 
> another example to make it easier to see):
> 
> re.sub("^1", "", "11111junk")
> 
> 	and get "junk".  Except it doesn't work.  What I get is:
> 
> '1111junk'
> 
> 	In other words, it replaces only the first "1", and no others.  I've
> read 
> the dox and the howto's and this is such a simple thing.  I can do it 
> another way, but I can't figure out why this doesn't work.  Can someone 
> help?
 
string = string.lstrip()

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk




-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.




More information about the Python-list mailing list