spilt question

Fábio Santos fabiosantosart at gmail.com
Thu May 16 11:14:27 EDT 2013


str.split takes a limit argument. Try your_string.split('_', 1)
On 16 May 2013 16:11, "loial" <jldunn2000 at gmail.com> wrote:

> I want to split a string so that I always return everything BEFORE the
> LAST underscore
>
> HELLO_xxxxxxxx.lst         # should return HELLO
> HELLO_GOODBYE_xxxxxxxx.ls  # should return HELLO_GOODBYE
>
> I have tried with rsplit but cannot get it to work.
>
> Any help appreciated
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130516/e876bce9/attachment.html>


More information about the Python-list mailing list