繁体   English   中英

如何建立从节点js到python的连接?

[英]how to make connection from node js to python?

我是Node js和python的新手,只是我想将Node js传递给python,反之亦然。 我需要运行在Web浏览器上并托管在Web浏览器上的简单脚本,以在node js中获取已执行的python脚本。 在托管环境下运行node js脚本后,只想将一条消息从node js传输到python。

您需要使用系统调用从nodejs执行python代码。

var exec = require('child_process').exec;
var cmd = 'python myscript.py';

exec(cmd, function(error, stdout, stderr) {
  // command output is in stdout (This the output from the python script that you might use
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM