python from java.util import ArrayList def append_data(data): list = ArrayList() for item in data: list.add(item) return list import org.python.util.PythonInterpreter; import org.python.core.PyList; public class Test { public static void main(String[] args) { PythonInterpreter interpreter = new PythonInterpreter(); interpreter.execfile("test.py"); interpreter.exec("result = append_data([1, 2, 3])"); PyList resultList = (PyList) interpreter.get("result"); System.out.println(resultList); } }


上一篇:
下一篇:
切换中文