python中实现两个列表的交叉合并

 

001、

>>> list1 = ["aa", "bb", "cc", "dd"]       ## 列表1
>>> list2 = [111, 222, 333, 444]           ## 列表2
>>> list3 = []
>>> for i in range(len(list1)):
...     list3.append(list1[i])
...     list3.append(list2[i])
...
>>> list3                                 ## 交叉合并结果
['aa', 111, 'bb', 222, 'cc', 333, 'dd', 444]

 

 

posted @ 2023-09-29 21:42  小鲨鱼2018  阅读(166)  评论(0编辑  收藏  举报