如何使节点js连接到python?

我是新来的节点js和python只是我想通信节点js到python,反之亦然。 我需要一个简单的脚本来运行并在Web浏览器上托pipe节点js中执行python脚本。 只需要运行带有托pipe环境的节点js脚本,就可以将一个消息从节点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 });