python-3.x - 为什么构造函数中的实例变量没有显示在输出中?
问题描述
class Employee:
def __int__(self):
self.eno=100
self.ename='Hari'
self.esal=10000
e=Employee()
print(e.__dict__)
解决方案
更改def __int__(self):
为def __init__(self):
.
推荐阅读
- javascript - CF7 表单提交成功后永久隐藏 Div,直到缓存或 cookie 被清除
- jquery - 我在 jquery 数据表中添加了“上一季度”,但我没有得到预期的结果
- java - connection.controlTransfer 的含义
- c# - 尝试覆盖组合框样式的文本框(System.windows.markup.staticresourceholder 异常)
- c - 是否可以在命令 objcopy 的帮助下进行硬编码
- python - 将屏幕截图添加到 Pytest Html 报告时出错
- javascript - 当用户单击链接时,是否有动态更改导航菜单的内容?
- javascript - 尝试 S3.getSignedUrl() 时出现“str.indexOf 不是函数”错误
- angular - 如何更改内容并以角度将其登录到控制台?
- kiwi-tcms - Kiwi-tcms v8.0 数据库迁移问题与测试运行