二维数组转为一维数组
已知a = [[4, 0, 1], [9, 2, 7], [8, 12, 90]]
1.列表推导式
[i for j in a for i in j]
2. itertools
from itertools import chain
list(chain.from_iterable(a))
3.sum小技巧
sum(a, [])
4. operator
import operator
from functools import reduce
print(reduce(operator.add, a))
列表推导式参:《Python列表推导式和嵌套的列表推导式》