python __init__()
来源:互联网 发布:怎么在知乎回答问题 编辑:程序博客网 时间:2024/05/24 23:15
现在可以简单理解为构造函数
import osimport sysclass A(object): def __init__(self, name, year): self.name = name self.year = year def getName(self): return 'A ' + self.nameif __name__ == '__main__': a = A('hello', 2017) print a.getName()
输出:
A hello
参考:
https://www.cnblogs.com/zyxstar2003/archive/2011/03/21/1989954.html
阅读全文
0 0
- python __init__()
- python self __init__
- python __init__.py
- python __init__.py
- python __new__ __init__
- python __init__.py
- python __init__.py
- python之 __init__.py
- python __init__.py介绍
- 【python】__init__.py
- python __init__.py详解
- python __init__.py
- Python __new__ ,__init__,__call__
- python __init__.py
- Python模块 - __init__.py
- Python中的__init__,__call__
- Python中的__init__,__call__
- python __init__.py
- matlab 计算机视觉工具箱step含义
- JVM调优总结(一)-- 一些概念
- laravel HTTP 控制器
- Smali注入弹框代码
- easyui-tree自动勾选指定的节点checkbox(回绑数据)
- python __init__()
- Android动画之属性动画(四)
- tiny6410开发板使用NFS访问Ubuntu主机
- 博客工具使用练习
- ADTS包头解析
- sqlserver 查询数据分页,类似mysql的limit0,20
- 深度学习之Windows下安装faster-rcnn
- 数字计算
- mybatis做like模糊查询