函数和方法的区别

def  eat():

      print(1)

      print(2)

eat()               #调用函数

class Person:

      def eat2(self):

      print(1)

      print(2)

p=person()

p.eat2()    

                      #使用方法

猜你喜欢

转载自www.cnblogs.com/helloxiaocui/p/9297756.html