//引用jar包 jython-standalone-2.5.3.jar
//java端
import org.python.util.PythonInterpreter;
public class Test{
/**
* @param args
*/
public static void main(String[] args) {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("user_name=\"Clark\"");
interpreter.exec("user_age=25");
interpreter.execfile("E:\\a.py"); }
}
/*E:\a.py(Python3.2)
def Hello(name,age):
print ("Hello,"+name+"! Your age is "+str(age));
Hello(user_name,user_age)
*/
//输出:Hello,Clark! Your age is 25