【发布时间】:2018-09-09 03:35:56
【问题描述】:
k=['d','e','f']
v=[4,5,6]
h=zip(k,v) #zipping
for i,j in h:
print(i ,':',j)
(k,v)=zip(*h) #unzipping
print(k)
print(v)
output:
Traceback (most recent call last):
File "hasht.py", line 6, in <module>
(k,v)=zip(*h)
ValueError: not enough values to unpack (expected 2, got 0)
【问题讨论】:
标签: python-3.x python-2.7 dictionary hashtable