zip函数将名/值列表链接到一起
In [1]: names = [‘name‘, ‘age‘, ‘pay‘, ‘job‘]
In [2]: values = [‘Sue Jones‘, 45, 40000, ‘hdw‘]
In [3]: a = zip(names, values)
In [4]: a
Out[4]: [(‘name‘, ‘Sue Jones‘), (‘age‘, 45), (‘pay‘, 40000), (‘job‘, ‘hdw‘)]
本文出自 “净空蓝星” 博客,请务必保留此出处http://jingkonglanxing.blog.51cto.com/1152128/1910314
原文地址:http://jingkonglanxing.blog.51cto.com/1152128/1910314