string.upto() and string.from()

Kent Johnson kent at kentsjohnson.com
Wed Mar 22 13:17:06 EST 2006


ikshefem at gmail.com wrote:
> Sure, you're right I forgot about rsplit !
> I guess the negative indexes & al could be done with
> 
> sep.join(xyz.split(sep)[:index])

For index=-1 use
xyz.rsplit(sep, 1)[0]

Kent



More information about the Python-list mailing list