Declaring variables from a list

Cactus le_cactus at msn.com
Sat Apr 9 06:44:12 EDT 2005


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message news:<mailman.1576.1112994277.1799.python-list at python.org>...
> "Cactus" wrote:
> 
> > If I got a list is it possible to declare a variable from the items in that list?
> >
> > Code Sample:
> > Blob = ['Var1', 'Var2', 'vAR3']
> > i = 5
> > for listitems in Blob:
> >    i += 1
> >    listitems = i
> >
> > print Var1
> > 6
> > print Var2
> > 7
> > print vAR3
> > 8
> >
> 
> > Something like that? This doesn't work (obviously) but is there a way to do this?
> 
> why?
> 
> if you want a dictionary, use a dictionary (see the tutorial for details).
> 
> </F>

Thanks,

I'll look in to that. Seems like that will work....

Cacti



More information about the Python-list mailing list