zip() 用于合并两个序列,就像拉链一样把两个序列合并在一起,体验一下下面的例子:
In [1]: list1 = ["name", "age", "gender"] In [2]: list2 = ["Jeny", 18, "woman"] In [3]: zip(list1, list2) Out[3]: [('name', 'Jeny'), ('age', 18), ('gender', 'woman')]