Python全栈之路系列之面向对象特殊成员
类的特殊成员之call #!/usr/bin/env python # _*_coding:utf-8 _*_ class SpecialMembers: # 类的构造方法 def __init__(self): print("My Blog is Url: http://ansheng.me") # 对象的构造方法 def __call__(self): print("My Name is: Ansheng") # 创建一个对象,并且执行类的构造方法 obj = SpecialMembers() # 执行对象的构造方法 obj() # 先执行类的构造方法,然后在执行对象的构造方法 SpecialMembers()() 输出 ansheng@Darker:~$ python3 /home/ansheng/文档/Python_code/sublime/Week06/Day04/s2.py My Blog is Url: http://ansheng.me My Name is: Ansheng My Blog is Url: http://ansheng.me My Name is: Ansheng 类的特殊成员之getitem、setitem、delitem 在学习过程中有什么不懂得可以加我的 python学习交流扣扣qun,784758214 群里有不错的学习视频教程