[Tutor] Help with Re to extract fixed width data fields
Thu, 14 Sep 2000 18:25:52 -0500
On Fri, Sep 15, 2000 at 09:40:17AM +1200, Phil Bertram wrote:
> I have data that is of fixed length but with no deliminaters
> eg. 3456Customer9878Product etc etc etc
> I have been using a regular expression (in the form as shown below) to extract the fields. The real data has over 30 fields so the expression is very large.
> Is there a better way ?
You say it is always fixed length? If so, you can use indices
(indexes?) to extract it, like so:
>>> mystring = "3456Customer9878Product"
Very spiffy, fast, and requires no extra modules...
Ben Beuchler firstname.lastname@example.org
MAILER-DAEMON (612) 321-9290 x101
Bitstream Underground www.bitstream.net