开发者

python: calling java program

开发者 https://www.devze.com 2023-04-09 19:59 出处:网络
I have a tag cloud generator that I would like to call from my python program. How can I do it? I 开发者_C百科run it in a batch file

I have a tag cloud generator that I would like to call from my python program. How can I do it?

I 开发者_C百科run it in a batch file

java -jar ibm-word-cloud.jar -C configure.txt input.txt output.png

thanks for your help.


The subprocess module is now preferred over os.system(). A simple example, assuming run_prog.bat contains the command you need:

import subprocess
cmd = "run_prog.bat"
proc = subprocess.Popen(cmd)


You can use the os module:

import os
os.system('mybatchfile.bat')

or use the subprocess module

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号