get object attributes python
for att in dir(your_object):
print (att, getattr(your_object,att))
get object attributes python
for att in dir(your_object):
print (att, getattr(your_object,att))
python object with attributes
class Object(object):
pass
a = Object()
a.somefield = somevalue
attributes in python
class Monkey(object):
def __init__(self, name): # This will done automatically when cmd in 7th line will be executed
self.name = name # This is an attribute.
def speak(self): # This is a method
print("Hello! I am " + self.name)
IronMan = Monkey('TonyStark')
IronMan.speak() # This will use the function 'speak' defind in class 'Monkey'
# Created By ....
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us