variable hell

Adriaan Renting renting at astron.nl
Thu Aug 25 17:06:54 CEST 2005


You might be able to do something along the lines of

for count in range(0,maxcount):
  value = values[count]
  exec(eval("'a%s=%s' % (count, value)"))
 
But I am also wonder: why? 

Peter Maas wrote: 
> >>>suffix = 'var' 
> >>>vars()['a%s' % suffix] = 45 
> >>>avar 
>45 
 




More information about the Python-list mailing list