[Tutor] variable name based on variables (expansion?)
potus98 at yahoo.com
Mon Feb 28 15:05:44 CET 2005
a python 2.3 noob asks:
# I have some lists
# I want to change specific list elements
# But I want the assignment
# to be based on variables
# But the variable assignment above does not work.
# Python complains of a syntax error.
# I've also tried variations of eval(), single ticks,
# back ticks, quotes, etc... but I just can't seem
# to get the syntax right.
# Can someone please provide a working example?
# In case it matters, here are additional details:
# My python script imports a module named GameLogic.
# My script is called fresh every time it's used;
# therefore, some variables must be stored in
# such as GameLogic.varA, GameLogic.varB, etc... so
# they are available for later use. It all works fine
# if I hardcode things, but I'd rather use variables
# since I will eventually have 20 lists with at least
# 10 positions in each list.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Tutor