Thanks
Actually the number I am getting it is from slicing from a long text
line. I need to slice 10 characters from that line but no string only
numeric numbers. When I am slicing 10 characters those A, c, O is coming
at the end.
Thanks
-----Original Message-----
From:
[email protected]
[mailto
[email protected]] On Behalf Of
Dennis Lee Bieber
Sent: Wednesday, September 10, 2008 3:45 PM
To: (e-mail address removed)
Subject: Re: removing text string
I need to remove text string from the list of the numbers mentioned
below:
080829-7_A
070529-5_c
080824-7_O
070405_6_p
? Is that last one an error that is supposed to be
....5-6_, not
....5_6_ ?
1) If the required data is fixed width, just slice it
out = inp[:8]
2) If the data is variable width but has a fixed delimiter,
find
the delimiter position and then slice (this is the reason for my
question above -- this method) OR just split on the delimiter and take
the part you need.
out = inp.split("_")[0]
3) If the data is more complex (again if that last line
with two _
is supposed to be trimmed after the second, and the first turned into a
-) you will need to fully define the parsing rules of the data.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/