string.upto() and string.from()

Kent Johnson kent at kentsjohnson.com
Wed Mar 22 19:17:06 CET 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