|
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
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-6-17 23:59
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社