AttributeError: ‘dict_keyiterator‘ object has no attribute ‘next‘

  1. 报错:AttributeError: ‘dict_keyiterator’ object has no attribute ‘next’
  2. 原因:
    Python2曾使用过iter.next()的方法,Python3更新为了next(iter),在某些环境中会自动把Python2的语法转换为Python3,在不能转换时就报错。
  3. 解决方案:
    使用next(iter)的形式来使用迭代器

猜你喜欢

转载自blog.csdn.net/ftimes/article/details/119639198