spilt question

Walter Hurry walterhurry at lavabit.com
Thu May 16 11:10:14 EDT 2013


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_xxxxxxxx.lst         # should return HELLO
> HELLO_GOODBYE_xxxxxxxx.ls  # should return HELLO_GOODBYE
> 
> I have tried with rsplit but cannot get it to work.
> 
mystr.rsplit("_",1)[0]



More information about the Python-list mailing list