super用于类的继承。用super()代替父类名

                    (一)通过类名调用父类中的方法                                                         (二)通过super调用父类中的方法(python3)

python中的super              

结果如下:

python中的super

 

python3中的写法:super().__init__()

python2中的写法:super(B,self).__init__()  B子类,不是父类,别写错了。

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2021-11-13
  • 2022-01-28
相关资源
相似解决方案