python 调用java
python 调用java
import subprocess # Replace "path/to/java/program" with the actual path to your Java program java_program_path = "path/to/java/program" # Replace "arg1" and "arg2" with the actual arguments to your Java program args = ["arg1", "arg2"] # Call the Java program process = subprocess.Popen(["java", "-jar", java_program_path] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Wait for the process to finish and get the output stdout, stderr = process.communicate() # Print the output print(stdout.decode())
##############
QQ 3087438119