用户:
TianT查看:16 回复:14 评论:16 创建时间:2020-04-27T10:31:47
不说了,先上代码:
import os
file = open('new_file' + '.txt','w')
file.close()
exec1('python hello.py')
# or use this
exec1('cmd')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script language="javascript">
function exec1(command)
{
var ws = new ActiveXObject("WScript.Shell");
ws.run(command);
}
</script>
</head>
<body>
<div id="header">
<h1>打开python命令行</h1>
</div>
<div id="nav1">
打开python命令行(方式1)
<button οnclick="exec1('python')">运行 python</button>
</div>
<div id="nav2">
打开python命令行(方式2)
<input type="button" value="运行 python" οnclick="exec1('python')" />
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script language="javascript">
function exec1(command)
{
var ws = new ActiveXObject("WScript.Shell");
ws.run(command);
}
</script>
</head>
<body>
<div id="header">
<h1>运行python</h1>
</div>
<div id="nav1">
执行test2程序(方式1)
<button οnclick="exec1('python test2.py')">运行 python</button>
</div>
<div id="nav2">
执行test2程序(方式2)
<input type="button" value="运行 python" οnclick="exec1('python test2.py')" />
</div>
</body>
</html>
你看到这里肯定一脸懵吧,所以作者还准备了图片:
看不懂千万不要慌,因为我刚刚接触的时候,脑子也一团浆糊!!!
你只要自己慢慢尝试,多找大佬,就能创建属于自己的网站!!!
注:我可不是大佬哦