Python uzyskaj atrybut obiektu według ciągu

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