Heim > Fragen und Antworten > Hauptteil
比如a = [1, 2, 3], b = [4, 5, 6] 合并为[1, 4, 2, 5, 3, 6] 你觉得怎么写比较优雅?
大家讲道理2017-04-17 14:30:20
a = [1,2,3] b = [4,5,6] s = [] for i in zip(a,b):s.extend(list(i)) print s
[1, 4, 2, 5, 3, 6]