autodataming的个人博客分享 http://blog.sciencenet.cn/u/autodataming

博文

python 列表扁平化

已有 5184 次阅读 2017-7-15 09:39 |系统分类:科研笔记

import itertools

a = [["a","b"], ["c"]]

print list(itertools.chain.from_iterable(a))



https://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists?answertab=votes


https://gxnotes.com/article/24699.html



https://blog.sciencenet.cn/blog-950202-1066470.html

上一篇:phantomjs自动保存文件
下一篇:redis
收藏 IP: 202.127.19.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-17 23:59

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部