本文共 449 字,大约阅读时间需要 1 分钟。
???Win7 + Python 3.5.2
????????????????????????????????????????????
?????????
??itertools.chain???????????????????????????????????
from itertools import chaina = [[1, 2], [3, 4]]a_ = list(chain(*a))print(a_)
?????
[1, 2, 3, 4]
?????????????????????????
????Python?????
???????????????????????????????????
a = [[1, 2], [3, 4]]a_ = [x for j in a for x in j]print(a_)
?????
[1, 2, 3, 4]
????????????????????????????
???????????????????????????????
转载地址:http://fszc.baihongyu.com/