python2.7中出现TypeError: must be type, not classobj

class Person:
    def __init__(self,name,age):
        self._name = name
        self._age = age


class Student(Person):
    def __init__(self,name,age,id):
        super(Student, self).__init__(name,age)
        self._id = id

原因:

super只能用于python的新类中,如果基类是经典类,则会报这个错

新类:所有类都必须要有继承的类,如果什么都不想继承,就继承object类。
经典类:什么都不继承的类,如上面的Person就是经典类。所以报错

解决方法:

让Person继承object

class Person(object):
原文地址:https://www.cnblogs.com/hupeng1234/p/6699098.html