这是我的简单html代码index.html
<html>
<head>
<script type="text/javascript" src="index.js"></script>
</head>
<body>
<input type="button" onclick="fun()" value="alert">
</body>
</html>
这是index.js文件
fun(){}
const spawn=require('child_process').spawn;
const process=spawn('python',['./hello.py']);
process.stdout.on('data',(data)=>{
console.log(data.toString());
})
}
这是hello.py文件
print("Hello world")
我已经试过了,但在点击按钮时,这给了我关于require的错误。。 有什么建议吗?我该怎么做
目前没有回答
相关问题 更多 >
编程相关推荐