Collapse a list and eval ??

TAG tonino.greco at gmail.com
Fri Oct 8 04:20:05 EDT 2004


HI,

If I have a list :

data=['round', '(', '(', 12345, '*', '-', '0.0025', ')', ',', '2', ')', '']

how can I collapse it so that it becomes:
data_collapsed=['round((12345*-0.0025),2)']

and then run an eval() on it ?

Am I doing this the right way ?

Thanks
Tonino



More information about the Python-list mailing list