摘要: 一,什么是模块? 常见的场景:一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀。 但其实import加载的模块分为四个通用类别: 1 使用python编写的代码(.py文件) 2 已被编译为共享库或DLL的C或C++扩展 3 包好一组模块的包 4 使用C编写并链 阅读全文
posted @ 2018-07-05 20:57 风依飘渺 阅读(170) 评论(0) 推荐(0)
摘要: __len__ class A: def __init__(self): self.a = 1 self.b = 2 def __len__(self): return len(self.__dict__) a = A() print(len(a)) __hash__ class A: def __ 阅读全文
posted @ 2018-07-05 11:02 风依飘渺 阅读(136) 评论(0) 推荐(0)