Paul McGuire:
> This code creates a single dict for the input lines, keyed by id.
> Each value contains elements labeled 'id', 'ra', and 'mjd'.
...
> d = dict(
>             (rec.split()[1][:-1],
>              dict([('id',rec.split()[1][:-1])] +
>                   [map(str.lower,f.split('='))
>                       for f in rec.split()[2:5]] ) )
>              for rec in data
>         )
...

Please, don't try to shove the program in one line, use PyParsing :o)

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to