Adriaan Renting wrote: > Not in my Python. > > >>>>for count in range(0, 10): > > ... value = count > ... exec("'a%s=%s' % (count, value)") > ... > >>>>dir() > > ['__builtins__', '__doc__', '__name__', 'count', 'value']
You did not copy the suggestion properly: >>> for count in range(0, 10): ... exec 'a%s = %s' % (count,count) ... >>> dir() ['__builtins__', '__doc__', '__file__', '__name__', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'count'] >>> a5 5 (you can put additional parentheses around the string, but not additional quotation marks) Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list