博客
关于我
【python】多个list合并
阅读量:160 次
发布时间:2019-02-28

本文共 444 字,大约阅读时间需要 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/

你可能感兴趣的文章
Objective-C实现高斯消元法(附完整源码)
查看>>
Objective-C语法之代码块(block)的使用
查看>>
Objenesis创建类的实例
查看>>
OC Xcode快捷键
查看>>
OC 内存管理黄金法则
查看>>
OfficeWeb365 SaveDraw 文件上传漏洞复现
查看>>
office中的所有content type
查看>>
office之Excel 你会用 Ctrl + E 吗?
查看>>
OGG初始化之使用数据库实用程序加载数据
查看>>
ogg参数解析
查看>>
Oil Deposits
查看>>
OJ中处理超大数据的方法
查看>>
OJ中常见的一种presentation error解决方法
查看>>
OK335xS UART device registe hacking
查看>>
ok6410内存初始化
查看>>
Okhttp3添加拦截器后,报错,java.io.IOException: unexpected end of stream on okhttp3.Address
查看>>
OKR为什么到今天才突然火了?
查看>>
ol3 Demo2 ----地图搜索功能
查看>>
OLAP在大数据时代的挑战
查看>>
oldboy.16课
查看>>