【发布时间】:2021-05-18 15:59:16
【问题描述】:
我有一个从 Python 调用的 R 脚本,我想从中捕获输出。我可以写入 CMD 和 TXT,但我想在 Python 脚本中捕获输出,以便使用它。
在我尝试过的python脚本中:
logging.debug (os.popen ('Rscript testScript.r'))
但它不起作用。我也试过:
output = cmd ('Rscript testScript.r')
print (output)
但它返回 None 作为输出。
在 R 中我尝试过:returnValue (TRUE),但它写入 CMD,输出仍然是 None。
如何让 R 脚本返回一个值,我可以过滤以查看结果???
非常感谢您。
【问题讨论】: