0

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.

0

1 Answer 1

1

Your class init function is spelled wrongly, this should be __init__ instead of __int__:

def __init__(self, name, species):
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks very muchhhh. You've save my days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.