>data = [ ]
>for i in xrange(1,101):
> data = "" %i _n, f %i_v))
The function locals() will return a dictionary of variables in the current scope. This can then be used to reference variables by name.
x=1
xname = 'x'
print locals()['x']
print locals()[xname]
This prints:
1
1
or for your example.
data = [ ]
for i in xrange(1,101):
data = "">
Hope this helps.
pjw
>for i in xrange(1,101):
> data = "" %i _n, f %i_v))
The function locals() will return a dictionary of variables in the current scope. This can then be used to reference variables by name.
x=1
xname = 'x'
print locals()['x']
print locals()[xname]
This prints:
1
1
or for your example.
data = [ ]
for i in xrange(1,101):
data = "">
Hope this helps.
pjw
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor