# coding:utf-8if __name__ =='__main__':'''
通过super().方法(参数1,参数2......)调用,该用法要求python版本3以上
或
supper(子类名,self).方法(参数1,参数2......)
'''classF(object):deftalk(self, name):print(f'super name is {name}')classG(F):deftalk(self, children_name, super_name):
self.print_children_name(children_name)super().talk(super_name)deftalk2(self, children_name, super_name):
self.print_children_name(children_name)super(G, self).talk(super_name)defprint_children_name(self, name):print(f'children name is {name}')
g = G()
g.talk('小明','大明')# children name is 小明 super name is 大明
g.talk2('小明','大明')# children name is 小明 super name is 大明