0
点赞
收藏
分享

微信扫一扫

java4python

微言记 2022-02-11 阅读 17
javapython
PythonInterpreter interpreter = new PythonInterpreter();

//调整个文件
//interpreter.execfile("C:\\Users\\14779\\Documents\\IdeaProjects\\System\\src\\main\\java\\aa.py");

//调单个函数
interpreter.execfile("C:\\Users\\14779\\Documents\\IdeaProjects\\System\\src\\main\\java\\aa.py");
PyFunction pyFunction = interpreter.get("add", PyFunction.class);//函数名
int a = 5, b = 10;//准备参数
PyObject 函数返回值 = pyFunction.__call__(new PyInteger(a), new PyInteger(b));//调用函数(准备好的参数转python)
System.out.println("返回值是: " + 函数返回值);
举报

相关推荐

python(4)

Python基础(4)

python学习4

Python函数-4

4月4日java作业

JAVA 笔记4

java4

0 条评论