class Dog():
def __int__(self,breed,name,spots):
self.breed = breed
self.name = name
self.spots = spots
my_dog = Dog(breed='lab',name='Sammy',spots='No Spots')
答案 0 :(得分:1)
您有__int__
,应该有__init__
答案 1 :(得分:-1)
In [7]: class Dog():
...: def __init__(self, breed, name, spots):
...: self.breed = breed
...: self.name = name
...: self.spots = spots
...:
In [8]: my_dog = Dog(breed='lab', name='Sammy', spots='No Spots')
__init__
而不是__int__
。只需更改值即可。