pom
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>2.7.0</version>
</dependency>
代碼
package com.imooc;
import org.python.util.PythonInterpreter;
public class Test {
public static void main(String[] args) {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("print('Hello World')"); //此處python語句是3.x版本的語法
}
}
參考網上資料 自測得出