I’m looking for some advice on how to create a data structure by parsing a file.
This is the list i have in my file.
'01bpar( 2)= 0.23103878E-01 half_life= 0.3000133E+02 relax_time= 0.4328278E+02',
'01bpar( 3)= 0.00000000E+00',
'02epar( 1)= 0.49998963E+02',
'02epar( 2)= 0.23103878E-01 half_life= 0.3000133E+02 relax_time= 0.4328278E+02',
'02epar( 3)= 0.00000000E+00',
'02epar( 4)= 0.17862340E-01 half_life= 0.3880495E+02 relax_time= 0.5598371E+02',
'02bpar( 1)= 0.49998962E+02',
'02bpar( 2)= 0.23103878E-01 half_life= 0.3000133E+02 relax_time= 0.4328278E+02',
What I need to do is construct a data structure which chould look like this:
http://img11.imageshack.us/img11/7645/datastructure.gif
(couldn’t post it becouse of new user restriction)
I’ve managed to get all the regexp filters to get what is needed, but i fail to construct the structure.
Ideas?
Consider using a dict of dicts.
Produces:
Revised version in light of comments:
which produces: