python 合并数组为一个总数组

python 合并数组为一个总数组

import itertools

ab = itertools.chain(['it'], ['was'], ['annoying'])
list(ab)

#if there is a list of list
my_list = [['it'], ['was'], ['annoying']]
mergedList = itertools.chain.from_iterable(my_list)
list(mergedList )

 

posted @ 2021-06-25 16:00  ibingshan  阅读(192)  评论(0编辑  收藏  举报