collections 常用类型
from collections import defaultdict, Counter, deque dd = defaultdict(list) counter = Counter("hello") dq = deque([1, 2, 3])
堆操作
import heapq heap = [3, 1, 4, 1, 5] heapq.heapify(heap) print(heapq.heappop(heap)) # 1
转载请注明:周志洋的博客 » Python实用技巧-数据结构进阶