Reputation: 51
I have 2 file Python: Pet.py
class Pet(object):
def __int__(self, name, species):
self.name = name
self.species = species
def getName(self):
return self.name
def getSpecies(self):
return self.species
def __str__(self):
return "%s is %s" % (self.name, self.species)
And file petobject.py
from Pet import Pet
polly = Pet("Polly", "Parrot")
print "Polly is a %s" % polly.getSpecies()
When I run petobject.py I got this error : object() takes no parameters. Please help me with this error.
Upvotes: 0
Views: 159
Reputation: 6276
Your class init function is spelled wrongly, this should be __init__
instead of __int__
:
def __init__(self, name, species):
Upvotes: 1