我正在使用SSH / Shell从服务器上的Java程序调用python脚本,并且希望将Python脚本的打印语句显示在输出中,如何在python脚本中获取输出流并打印/记录到它?
Expect
is a tool that handles such interaction on the command line. No need to change your python script, just print it to stdout.
My best advice is to have a look at the java implementations of expect:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.