python - 检查 boost::python::tuple 的值为 None
问题描述
我正在尝试检查 boost::python::tuple 中的值是否为无。我有以下代码:
namespace py = boost::python;
py::list ls(inf.Module().attr("data_out"));
for (int i = 0; i < len(ls); i++){
py::tuple tuple = py::extract<py::tuple>(ls[i]);
if (tuple[1] == py::object()){ /* Does not work */
//do other stuff
}
}
这给了我:
TypeError: No registered converter was able to produce a C++ rvalue of type unsigned int from this Python object of type NoneType
谁能帮我吗?
解决方案
推荐阅读
- alloy - 使用 Double In 语句在合金中键入错误
- kubernetes - SolrCloud 的集群状态 API 返回无法从 kubernetes 集群外部访问的内部 kubernetes 主机名
- python - 试图让主管为 python-rq 创建一个工作人员
- python - Python Tkinter:有没有办法防止“标签”文本将列推到一边?
- webhooks - 什么是 Apple 服务器到服务器通知的重试策略
- excel - 来自 HTTP responseText VBA Excel 的表
- c++ - 反转链表会影响 main() 中原始链表的头指针。所以无法比较反向列表和原始列表 - C++
- microsoft-teams - 使用带有传入 webhook 的自适应卡片
- javascript - 使用 React Native Navigation 时超出最大调用堆栈大小
- python - 在 Ubuntu 18.04 上升级到 python 3.x