Variable Substitution in commands or funtion names?

Terry Reedy tjreedy at
Thu Jul 19 12:36:58 EDT 2001

> 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"]

If I understand correctly, try (not tested)

import cust
current = getattr(cust, CurCust)
print current['street']


Terry J. Reedy

More information about the Python-list mailing list