python技巧
合并大列表中的小列表
例如:
d = [[1, 2, 3], [3,4, 5], [6, 7]]
d=sum(d, [])
print(d)
#[1, 2, 3, 3, 4, 5, 6, 7]
上述的这个玩意,居然有时会报错
找到了另一个绝对不会报错的
a=[1,2,3]
b=[3,4,5]
c=[4,4,4]
from itertools import chain
d = list(chain(a, b, c))
print(d)
#[1, 2, 3, 3, 4, 5, 4, 4, 4]
这里有一大堆方法
https://blog.csdn.net/weixin_40539892/article/details/79103290