我在pytho脚本中使用subprocess.call()
执行python脚本。使用subproecss
执行的脚本是server
进程,它将结果发送回调用客户端。
result = subprocess.call('python -m module/coref_resolution/src/coref/corenlp &', shell = True)
有没有办法从corenlp.py接收result
变量的结果?
答案 0 :(得分:1)
import shlex
cmd = shlex.split('your command')
output = subprocess.Popen( cmd, stdout = subprocess.PIPE).communicate()[0]