circuitpython/tests/basics/setattr1.py
2015-02-14 23:35:00 +00:00

14 lines
155 B
Python

class A:
var = 132
def __init__(self):
self.var2 = 34
a = A()
setattr(a, "var", 123)
setattr(a, "var2", 56)
print(a.var)
print(a.var2)