博客
关于我
【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/

你可能感兴趣的文章
npm和yarn的使用对比
查看>>
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
NPOI利用多任务模式分批写入多个Excel
查看>>
NR,NF,FNR
查看>>
nrf开发笔记一开发软件
查看>>
NSDateFormatter的替代方法
查看>>
nsis 安装脚本示例(转)
查看>>
NSOperation基本操作
查看>>
NSSet集合 无序的 不能重复的
查看>>
NT AUTHORITY\NETWORK SERVICE 权限问题
查看>>
ntko web firefox跨浏览器插件_深度比较:2019年6个最好的跨浏览器测试工具
查看>>
ntko文件存取错误_苹果推送 macOS 10.15.4:iCloud 云盘文件夹共享终于来了
查看>>
Nuget~管理自己的包包
查看>>
nullnullHuge Pages
查看>>
NumPy 或 Pandas:将数组类型保持为整数,同时具有 NaN 值
查看>>
numpy 用法
查看>>
Numpy如何使用np.umprod重写range函数中i的python
查看>>
oauth2-shiro 添加 redis 实现版本
查看>>
OAuth2.0_JWT令牌-生成令牌和校验令牌_Spring Security OAuth2.0认证授权---springcloud工作笔记148
查看>>