先来看一个例子: class Fish: hungry=True def eat(self,food): if food is not None: self.hungry=False class User: def __init__(self,name): self.name=name f=Fish() Fish.eat(f, None) print(f.hungry) Fish.eat(f,'rice') f.eat('noodle') print(f.hungry) user=User('z…
变量是什么? 变量的作用 Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves…