stripping a string
Uwe Schmitt
uwe.schmitt at procoders.net
Tue Sep 16 05:56:45 EDT 2003
Leeds, Mark <mleeds at mlp.com> wrote:
hello : i am very much a python novice because
> I only use it for preprocessing data that
> i send into another language called Splus.
>
> I have the following problem that
> I have spent a lot of time on but I
> can't figure out.
>
> I have a string called tickerstring
> that might be
>
> "ANL LN32"
>
> and i want to get rid of the digit piece.
> so that i get "ANL LN"
>
> i can't just take off the last two charcters
> because the string could also be
>
> "ANL LN3" for example.
>
> thanks to anyone who could explain
> how to do this ?
>
If the numbers only occur at the end of the string:
a = "ANL LN32"
print a.rstrip("0123456789")
Greetings, Uwe.
--
Dr. rer. nat. Uwe Schmitt http://www.procoders.net
schmitt at procoders.net "A service to open source is a service to mankind."
More information about the Python-list
mailing list