Node.js应用程序和Python应该如何交互?我可以有一个简单的node npm包来运行Node.js代码中的脚本,还是更复杂呢?我还有什么遗漏吗?
谢谢!
发布于 2017-11-22 13:30:42
使用child_process来自Node.js文档(链接)
var exec = require('child_process').exec;
var output = '';
var child = exec('python some/file.py');
child.stdout.on('data', function(data) {
output += data;
});
child.on('close', function() {
// Make your API call here
console.log(result);
});
https://stackoverflow.com/questions/47435918
复制相似问题