Cet article décrit la méthode de Java se référant à Jpython. Partagez-le pour votre référence, comme suit:
Importer java.util.arraylist; import java.util.list; import org.python.core.pyException; import org.python.core.pyinteger; import org.python.core.pyobject; import org.python.util.pythoninterpreter; public class pyton {public static void Main (string [] args) throws {Public Static Void Main (string [] args) throws {Public STATIC STATIC VOID MAIN PythonInterpreter interpror = new pythoninterpreter (); System.out.println ("Hello, Brave New Interp.exec (" Importer Sys "); Interp.Exec (" Print Sys "); Interp.set (" A ", New Pyinteger (42)); Interp.exec (" Print 'Test =' + Str (A) "); Interp.Exec (" x = 2 + 2 "); PyoBject X = interp.get (" x "); System.out.println (x: "+ x); = T.Search ('00: ifcsum: manifeste: '). Groupes () "); pyObject k = interp.get (" a "); list list = ((list) k .__ tojava __ (list.class)); // int Ai = ((enter) a .__ tojava __ (enter.class)). intvalue (); System.out.println (liste);J'espère que cet article sera utile à la programmation Java de tous.