Python Obtenha atributo de objeto por string

x = getattr(t, 'attr1')
setattr(t, 'attr1', 21)
Nutty Narwhal