类的实例没有输出
class Dog:def __init__(self,name,age):
self.name=name
self.age=age
def sit(self):
print(f'{self.name} is sitting')
def eat(self):
print(f'{self.name} want to eat')
pet=Dog('xiaohei',6)///这个实例化怎么没有任何输出呢?
>>> pet=Dog('xiaohei',6)
>>> pet.sit()
xiaohei is sitting
>>> pet.eat()
xiaohei want to eat
页:
[1]