How to use the super () function in Python
I believe many inexperienced people don't know what to do about how to use the super () function in Python. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
The code experiment shows:
# inheritance relationship object-> Person-> Student-> SchoolBoy# python2 Syntax: # class Person (object): # python3 Syntax: # class Person (): class Person (): # class Person (object):''define the base class Person''' def _ init__ (self, name, age):' 'initialize the properties name and age'''self.name = name self.age = age def printInfo (self): print ('-- I am an instance object Belongs to type: {0: ^ 35}-my name is: {1: {3}