How to find the first space?

Johny python at hope.cz
Mon Jun 9 11:02:51 EDT 2008


How can I find the first space using regex?

For example I have text
Text=' This is a sample '

The last space I can remove by
Text=re.sub(r"\s(?!\w)",'',Text)

but I do not know how to remove the first space.
Can anyone help?

Thanks
L.



More information about the Python-list mailing list