Variable Substitution in commands or funtion names?

fleet at teachout.org fleet at teachout.org
Thu Jul 19 09:25:41 EDT 2001


I think I may have gotten myself into a box.

I have a module "cust.py" that contains several dictionaries - each
references a different customer with address info, etc. such as:

smith={"busname":"Smitties", "street":"123 West Ave"}

Parsing the csv output of a spreadsheet allows me to assign "smith" to a
variable - CurCust.

Now I want to do something like:

from cust import CurCust

print cust.CurCust["street"]

Spent the evening trying to solve this (Learning Python, and Sam's Teach
Yourself Python) then tried the archives.  The little I found on "variable
substitution" almost seems to say "no way!" ???

(I know someone is going to suggest a database.  That's a little further
up the learning curve.  I can see it from here; but I'm not there yet.)

Thanks for any assistance,
					- fleet -






More information about the Python-list mailing list