代码如下:public class CourseScrawler {
public static int[][] getCourseArray(String stuID, String pwd) {
PythonInterpreter interp = new PythonInterpreter();
interp.execfile("src/course-scrawler.py"); //引入Python文件
PyFunction func = (PyFunction)interp.get("getCourseArray",
PyFunction.class);
PyObject pyobj = func.__call__(new PyString(stuID),
new PyString(pwd)); //给Python函数传参
int[][] courseArray = (int[][])pyobj.__tojava__(int[][].class); //将返回结果转换为Java数据类型
return courseArray;
}
出错如下:
![图片说明](https://img-ask.csdn.net/upload/201605/24/1464082008_34561.png)
包的放置:![图片说明](https://img-ask.csdn.net/upload/201605/24/1464082053_459001.png)
build path的设置:![![图片说明](https://img-ask.csdn.net/upload/201605/24/1464082148_788166.png)图片说明](https://img-ask.csdn.net/upload/201605/24/1464082123_871820.png)