Holen Sie sich Objektattribute Python
for att in dir(your_object):
print (att, getattr(your_object,att))
Smoggy Serval
for att in dir(your_object):
print (att, getattr(your_object,att))
x = getattr(t, 'attr1')
setattr(t, 'attr1', 21)
import inspect
class myclass:
a = 5
def method(b):
return b
for i in inspect.getmembers(myclass):
print(i)
getattr(object, 'attribute_name')
field_name = "fullName"
print getattr(user, field_name) # prints content of user.fullName