Shawn Milochik wrote: >> 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.
You can use named groups in a single regular expression. Stefan -- http://mail.python.org/mailman/listinfo/python-list