"Variable variable name" or "variable lvalue"
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Aug 15 15:09:30 EDT 2007
On Wed, 15 Aug 2007 10:42:02 -0700, mfglinux wrote:
> I would like to know how to declare in python a "variable name" that
> it is in turn a variable
> In bash shell I would wrote sthg like:
>
> for x in `seq 1 3`
> do
> M$i=Material(x) #Material is a python class
> done
You want a dictionary.
M = dict()
for x in xrange(1, 4):
M[x] = Material(x)
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list