Collapse a list and eval ??

TAG tonino.greco at gmail.com
Fri Oct 8 10:25:37 CEST 2004


oohh - damn - forgot the join ;)
THANKS ;)

sometimes the simplest solution is often overlooked ;)



On Fri, 8 Oct 2004 16:23:18 +0800, limodou <limodou at gmail.com> wrote:
> data_collapsed = [''.join(data)]
> 
> 
> 
> 
> On Fri, 8 Oct 2004 10:20:05 +0200, TAG <tonino.greco at gmail.com> wrote:
> > 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
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> 
> --
> I like python!
>



More information about the Python-list mailing list