python3中,字典类型不再有iteritems的方法

d1={'a':1,'b':2} 

for x,y in d1:

    print(x,y) 错误,ValueError: not enough values to unpack (expected 2, got 1)


for x,y in d1,items():

        print(x,y)


可以正常显示,d1.items()为一个列表。

python3中不再有iteriterms()方法

请先 登录 后评论
  • 0 关注
  • 0 收藏,513 浏览
  • 石天 提出于 2016-11-23 03:26

相似问题