首页 > 解决方案 > 为什么构造函数中的实例变量没有显示在输出中?

问题描述

class Employee:
    def __int__(self):
        self.eno=100
        self.ename='Hari'
        self.esal=10000
e=Employee()
print(e.__dict__)

标签: python-3.x

解决方案


更改def __int__(self):def __init__(self):.


推荐阅读