收集小技巧
python ascii-数字转换
a = 'a'
ord(a) #转数字
chr(10) #转字符
python 双端队列
from collections import deque
a = deque()
a.append(1)
a.append(2)
a.pop()
a.popleft()
python 堆结构
import heapq
a = [3,2,1]
heapq.heapify(a) #最小堆排序
heapq.heappush(a,4) #添加元素,再次排序
heapq.heappop(a) #弹出堆顶元素
shell列出目录树形结构
#安装tree
brew install tree
#使用tree命令
tree
#深层结构
tree -L 2
python 初始化数组
res = ["" for _ in range(10)]
res[0]="abc"