Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

__dict__ python?

class DogClass:
    def __init__(self,name,color):
        self.name = name
        self.color = color
    
    def bark(self):
        if self.color == "black":
            return True
        else:
            return False
dc = DogClass('rudra','white')
print(dc.__dict__)
# Output: {'name': 'rudra', 'color': 'white'}

DogClass.__dict__
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
8+9 =