Stefan Lesicnik wrote:
Hi guys,

Im trying to do something and hit a bit of a wall, potentially im
going about this the wrong way. Essentially the problem is:

features file contains
rt='''text'''

import features

a = 'rt'
print features.rt  #this works
print features.a  #this fails

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)



--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to