VariableSubstitution in commands or funtion names?

fleet at teachout.org fleet at teachout.org
Thu Jul 19 19:33:21 CEST 2001


Beautiful - Thank you!
				- fleet -

>   Date: Thu, 19 Jul 2001 16:36:58 GMT
>   From: "Terry Reedy" <tjreedy at home.com> Subject:
>
>> 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']
>
>etc
>
>Terry J. Reedy







More information about the Python-list mailing list