我想将 org.python.core.PyObject 转换为 java.lang.Boolean。 类似于:
boolean i = ((Boolean) PyObject).booleanValue();
最佳答案
只需尝试以下操作:
PyObject obj = interpreter.eval("True");
boolean i = ((PyInteger) obj).asInt() != 0;
关于java - 如何将 PyObject 转换为 java boolean 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9387694/