Python 类属性
来源:互联网 发布:java微信开发框架 编辑:程序博客网 时间:2024/05/16 04:21
代码示例:
class A: """class A Doc.""" def __init__(self): self.i = "001" self.j = "002" def a(self): return "fun a" def b(self): return "fun b"class B(A): """class B Doc.""" def c(self): return "fun c" def d(self): return "fun d"print A.__doc__ # 类型帮助信息print A.__name__ # 类型名称print A.__module__ # 类型所在模块print B.__bases__ # 类型B所继承的基类print A.__dict__ # 类型字典,存储所有类型成员信息print A().__class__ # 实例类型print A().__module__ # 实例类型所在模块print A().__dict__ # 对象字典,存储所有实例成员信息
输出结果:
class A Doc.A__main__(<class __main__.A at 0x0000000001EEC828>,){'a': <function a at 0x0000000002779B38>, '__module__': '__main__', 'b': <function b at 0x0000000002779BA8>, '__doc__': 'class A Doc.', '__init__': <function __init__ at 0x0000000002779AC8>}__main__.A__main__{'i': '001', 'j': '002'}
0 0
- Python类属性,实例属性
- python类-属性
- Python 类属性介绍
- Python 类属性
- Python--类的属性
- python类:属性
- python 类属性
- python 类属性
- Python类的属性
- python类私有属性
- python 类属性
- Python类属性详解
- 类属性(1)-Python
- python内置类属性
- python-类的属性
- python 类属性
- Python 3.6 类属性
- python类的属性
- Android读取通讯录联系人
- Android Studio 导入项目
- phantomjs 执行时间超过一分钟的线程。杀死
- Oracle PL/SQL入门
- 在/sys下面创建属性文件
- Python 类属性
- jQuery deffered和promise对象方法
- centos 操作系统 安装 postgresql-9.4 postgresql-9.3
- Android 与 Unity3D 项目的整合的Bug
- linux下按文件大小查找文件
- ubuntu SVN server配置
- 93 The ORACLE_SID environment variable is set to +ASM. ASMLIB is not used in the configuration. You
- maven引入springframework的猫腻
- jdbcTemplate批量插入