[Tutor] importing variables

Alan Gauld alan.gauld at btinternet.com
Thu Nov 12 18:34:57 CET 2009


"bob gailer" <bgailer at gmail.com> wrote

>> I need to use features.a as i am iterating through a list and a would
>> be the different features i want to check if they exist, and then use
>> the variable.
>>
>> I hope that makes sense, or if anyone has any suggestion on how
>> properly to do this!
>
> Even though Alan missed your point, I understood it. So your explanation 
> was OK (for me).
>
> print getattr(features, a)

And now that I see Bob's solution I understand the question! :-)

Alan G. 




More information about the Tutor mailing list