zoukankan      html  css  js  c++  java
  • [python3] torndb中的itertools.zip[AttributeError: module 'itertools' has no attribute 'izip']

    在python3中,使用torndb进行查询时,遇到问题 AttributeError: module 'itertools' has no attribute 'izip',解决该问题过程中耗费了不少时间,故把解决办法写下以便以后遇到该问题的人能更快速的解决:

    因为python3中filter,map,zip本身就已经是generator了,所以torndb中的138行用到itertools.izip就显得有点多余了,所以需要改一下该代码,把return [Row(itertools.izip(column_names, row)) for row in cursor] 改为 return[Row(zip(column_names, row))for row in cursor],再运行程序,问题得到解决

  • 相关阅读:
    $dp$模板
    字符串基础
    基础算法

    图论
    山中无甲子,寒尽不知年
    模板集合(持续更新)
    数学基础——同余
    9.19 考试总结
    1-5-17:菲波那契数列
  • 原文地址:https://www.cnblogs.com/simplezhuo/p/9811369.html
Copyright © 2011-2022 走看看