circuitpython/tests/basics/getattr1.py

16 lines
208 B
Python
Raw Normal View History

2014-03-26 17:35:13 -04:00
class A:
var = 132
def __init__(self):
self.var2 = 34
def meth(self, i):
return 42 + i
a = A()
print(getattr(a, "var"))
print(getattr(a, "var2"))
print(getattr(a, "meth")(5))