python-3.x - Python 3,TypeError '>' ,从 2.7 到 3 的转换
问题描述
这里是 Python 新手,试图将其他人的代码从 python 2.7 更新到 3。我在这个文件上运行了 2to3,它在 2.7 上运行良好,但似乎语法在 3 中发生了变化?这种语法有什么问题导致错误?我怀疑与'>'相关的错误消息与最大请求有关?这是在带有 anaconda 和 python 3.7 的 jupyter notebook 中运行的。
~/jam2py3/simulation.py in get_max_age(model)
12 def get_max_age(model):
13 all_compartments = model.select_compartments(lambda c: True)
---> 14 oldest = max(all_compartments, key=lambda c: c.get_attr('age'))
15 return oldest.get_attr('age')
16
TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'
解决方案
推荐阅读
- html - 如果句子进入下一行,如何将jquery自动完成定位在单词旁边?
- python - Python3.7 获取两个目录下多个文件的差异
- react-native - 系统重启后 Expo 不启动
- r - 如何使用“for”循环用 ggplot2 绘制点?
- shell - 卷曲循环问题
- java - Java Spring Jpa 嵌入式实体 PropertyNotFoundException 找不到字段名称问题
- c++ - 如何将用户与一本书(图书馆系统)C ++联系起来
- node.js - 在 axios reactJs 中获取 net::ERR_SSL_PROTOCOL_ERROR
- wordpress - Wordpress 页面显示丢失的照片错误
- html - CSS背景图像未加载