Parsing of a file

Shawn Milochik Shawn at
Wed Aug 6 22:14:59 CEST 2008

> I would like to parse this file by extracting the field id, ra, dec and mjd
> for each line. It is
> not, however, certain that the width of each value of the field id, ra, dec
> or mjd is the same
> in each line. Is there a way to do this such that even if there was a line

Regular expressions will do the trick nicely.

> where Ra=****** and
> MJD=******** was swapped it would be parsed correctly?

Yes, but you'll probably have to look at each line three times or
split it into a list and check the elements.

> Cheers
>  Tommy
> --


More information about the Python-list mailing list