python-small-examples

@author jackzhenguo
@desc 
@date 2019/5/4

84 chain串联小容器为大容器

chain函数串联a和b,兼顾内存效率同时写法更加优雅。

from itertools import chain
a = [1,3,5,0]
b = (2,4,6)

for i in chain(a,b):
  print(i)
### 结果
1
3
5
0
2
4
6
[上一个例子](/python-small-examples/md/83.html) [下一个例子](/python-small-examples/md/85.html)