python : how to access object attribute given string corresponding to name of that attribute ?
- by Rohit
class test():
attr1 = int
attr2 = int
t = test()
x = "attr1"
I want to set/get value of attribute of t corresponding to x.
How do i do that ?
Thanks in advance.