variable hell

Robert Kern rkern at ucsd.edu
Fri Aug 26 04:24:40 EDT 2005


Adriaan Renting wrote:
> Not in my Python.
> 
> 
>>>>for count in range(0, 10):
> 
> ...     value = count
> ...     exec("'a%s=%s' % (count, value)")

But that's not what rafi suggested.

rafi:
> why using the eval?
>
> exec ('a%s=%s' % (count, value))

See the difference?

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list