python cookbook笔记

1,数据结构和算法

1.1,元组拆包

1.2,元组拆包*args

1.3,collections.deque:队列,保留最后几个元素

1.4,heapq.nlargest(),heapq.nsmallest():最大,最小几个元素

1.5,heapq.heappush(),heapq.heappop():优先级队列

1.6,collections.defaultdict:一键多值字典

1.7,collections.OrderedDict:有序字典,也可以用pd.Series

8,类与对象

8.1,obj == eval(repr(obj))

8.2,__format__特殊方法

8.3,上下文管理器

8.4,__slots__特殊方法

8.5,私有属性

8.6,@property属性管理,@property让函数变属性

8.7,多重继承:指定父类,super()

8.8,

猜你喜欢

转载自www.cnblogs.com/guxh/p/10293524.html