splitting tables

Diez B. Roggisch deets_noospaam at web.de
Sun Feb 8 11:10:03 EST 2004


> where -9999 (or somethinbg similar) indicates there is a blank, one space
> divides the columns and the elements can have a different number of
> digits. This is of course a worst-case scenario :)
> That is why I used split in the beginning, but then I fall into the other
> problem, when there is a missing value.
> Any suggestions will be much appreciated, thanks


The data looks like the different fields have different types - e.g. floats,
years, fixed width integers and so on - so you might be able to create a
regular expression like this:

"(CGA|) ([0-9]{4}|) ([0-9][2]|)"

You then could retrieve the single groups of the match. If a line doesn't
match, you either adapt the expression, or if thats not possible, create a
error-file that you could look over manually. 
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list