Re: spilt question

2013-05-16 Thread Dave Angel
On 05/16/2013 11:15 AM, Chris Angelico wrote: On Fri, May 17, 2013 at 1:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have

Re: spilt question

2013-05-16 Thread Ned Batchelder
On 5/16/2013 11:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help app

Re: spilt question

2013-05-16 Thread Tim Chase
On 2013-05-16 08:00, loial wrote: > I want to split a string so that I always return everything BEFORE > the LAST underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it to work. .r

Re: spilt question

2013-05-16 Thread Chris Angelico
On Fri, May 17, 2013 at 1:00 AM, loial wrote: > I want to split a string so that I always return everything BEFORE the LAST > underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get it t

Re: spilt question

2013-05-16 Thread Dave Angel
On 05/16/2013 11:00 AM, loial wrote: I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help ap

Re: spilt question

2013-05-16 Thread Walter Hurry
On Thu, 16 May 2013 08:00:25 -0700, loial wrote: > I want to split a string so that I always return everything BEFORE the > LAST underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_GOODBYE > > I have tried with rsplit but cannot get

Re: spilt question

2013-05-16 Thread Fábio Santos
str.split takes a limit argument. Try your_string.split('_', 1) On 16 May 2013 16:11, "loial" wrote: > I want to split a string so that I always return everything BEFORE the > LAST underscore > > HELLO_.lst # should return HELLO > HELLO_GOODBYE_.ls # should return HELLO_G

spilt question

2013-05-16 Thread loial
I want to split a string so that I always return everything BEFORE the LAST underscore HELLO_.lst # should return HELLO HELLO_GOODBYE_.ls # should return HELLO_GOODBYE I have tried with rsplit but cannot get it to work. Any help appreciated -- http://mail.python.org/m