import itertools
a= ['a','aa','aaa']
b= itertools.chain(a)
c= itertools.chain(*a)
print(a)
print(list(b))
print(list(c))
print结果
[‘a’, ‘aa’, ‘aaa’]
[‘a’, ‘aa’, ‘aaa’]
[‘a’, ‘a’, ‘a’, ‘a’, ‘a’, ‘a’]
import itertools
a= ['a','aa','aaa']
b= itertools.chain(a)
c= itertools.chain(*a)
print(a)
print(list(b))
print(list(c))
print结果
[‘a’, ‘aa’, ‘aaa’]
[‘a’, ‘aa’, ‘aaa’]
[‘a’, ‘a’, ‘a’, ‘a’, ‘a’, ‘a’]