返回顶部

收藏

Zip function demo: with dict function

更多
keys = ['spam', 'eggs', 'toast']
vals = [1, 3, 5]

D2 = {}
for (k, v) in zip(keys, vals): D2[k] = v

print D2

keys = ['spam', 'eggs', 'toast']
vals = [1, 3, 5]

D3 = dict(zip(keys, vals))
print D3

标签:Python,Buildin,Function

收藏

0人收藏

支持

0

反对

0

发表评论