python学习-61 类
2024-10-21 06:48:41
类
(在python2里)
1.属性
---数据属性
---函数属性
查看属性字典
class chinese:
rz:'huangzhong' print(chinese.__dict__)
运行结果:
{'__module__': '__main__', '__annotations__': {'rz': 'huangzhong'}, '__dict__': <attribute '__dict__' of 'chinese' objects>, '__weakref__': <attribute '__weakref__' of 'chinese' objects>, '__doc__': None} Process finished with exit code 0
执行方法:
class chinese:
rz:'huangzhong'
def school():
print('') print(chinese.__dict__)
chinese.__dict__['school']()
运行结果:
{'__module__': '__main__', '__annotations__': {'rz': 'huangzhong'}, 'school': <function chinese.school at 0x7f5325d6cd90>, '__dict__': <attribute '__dict__' of 'chinese' objects>, '__weakref__': <attribute '__weakref__' of 'chinese' objects>, '__doc__': None}
333 Process finished with exit code 0
最新文章
- jQuery原生框架-----------------核心框架
- 在MVC5和webAPI下是用Autofac依赖注入
- 转:RabbitMQ基础知识
- 从零开始学ios开发(九):Swapping Views
- Linq知识小结
- JavaSE生成随机数
- Python新手学习基础之数据结构-列表2 添加
- Mysql学习(慕课学习笔记2)数据库的创建与删除
- 推荐五个最好的MySQL GUI工具
- SSM框架通过mybatis-generator自动生成代码
- Django学习日记07_Admin
- XML解析的四种方法 建议使用demo4j解析 测试可以用
- Java实现inputstream流的复制
- 【深度好文】多线程之WaitHandle-->;派生EventWaitHandle事件构造-》AutoResetEvent、ManualResetEvent
- js 关于定时器的知识点。
- python之斐波那契数列递归推导在性能方面的反思
- JAVA框架:hibernate(二)
- sort命令的使用,结合uniq, awk等
- Material Design系列第一篇——Creating Apps with Material Design
- Java原子性、可见性、内存模型
热门文章
- JAVA常用处理数据
- git的搭建和使用
- 1-开发共享版APP(接入指南)-APP说明
- (LIS)最长上升序列(DP+二分优化)
- LOJ572. 「LibreOJ Round #11」Misaka Network 与求和 [莫比乌斯反演,杜教筛,min_25筛]
- 公司不用 Spring Boot,果断离职了!
- Cesium学习笔记-工具篇20-PrimitiveTexture自定义渲染-贴图【转】
- phpstudy apache 服务无法启动
- PostgreSQL--with子句
- RAID技术全解图解-RAID0、RAID1、RAID5、RAID100【转】