python itertools.chain的用法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python itertools.chain的用法相关的知识,希望对你有一定的参考价值。

from itertools import chain
a = [1,2,3,4]
b = ['x','y','z']
for x in chain(a,b):
    print(x)

以上是关于python itertools.chain的用法的主要内容,如果未能解决你的问题,请参考以下文章

理解 Python 的 itertools.chain 和 next

为啥 itertools.chain 比扁平化列表理解更快?

自然语言处理(NLP)——分词统计itertools.chain—nltk工具

itertools内置库

python函数的奇淫技巧——chain()函数

itertools:处理可迭代对象的模块