Re: [Tutor] no rsplit

2005-08-22 Thread luke
>v = "64x43x12" -> '64x43', '12' > > How split it by the las 'x'? [snip] >>>v = "64x43x12" >>>temp = v.split("x")[-1:] >>>print temp ['12'] that's the best I can do for now. HTH, -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/m

Re: [Tutor] no rsplit

2005-08-21 Thread Orri Ganel
Jonas Melian wrote: >v = "64x43x12" -> '64x43', '12' > >How split it by the las 'x'? > >In 2.4 it could be used rsplit("x",1) > >but i've 2.3.5 > >Is there another way of splitting a string from the end? >___ >Tutor maillist - [EMAIL PROTECTED] >http:

Re: [Tutor] no rsplit

2005-08-21 Thread Kent Johnson
Write your own? >>> def rsplitx1(s): ... try: ... i = s.rindex('x') ... return s[:i], s[i+1:] ... except ValueError: ... return s ... >>> rsplitx1('64x43x12') ('64x43', '12') >>> rsplitx1('64x43x') ('64x43', '') >>> rsplitx1('64') '64' Kent Jonas Melian wrote: > v = "64

[Tutor] no rsplit

2005-08-21 Thread Jonas Melian
v = "64x43x12" -> '64x43', '12' How split it by the las 'x'? In 2.4 it could be used rsplit("x",1) but i've 2.3.5 Is there another way of splitting a string from the end? ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinf