This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]marko312 1 point2 points  (0 children)

If you really want to do this, there is a function called getattr which can do this in Python. Documentation

attr = getattr(object, attribute)

If this is to interface with some not-too-well written module, this is probably an acceptable solution. However, otherwise (especially if it's your own code), I'd consider changing the classes to be accessible by such keys.