Johny wrote:

> 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?

Use the strip-method, as defined on stringlike objects.

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to