如何通过 XAMPP 在本地主机/本地服务器上 运行 Skulpt.org

How to run Skulpt.org on localhost / local server by XAMPP

嗨,我想测量 Skulpt 上基本操作(如范围等)的执行时间(Python 在浏览器中) 我知道 Skulpt.org 有在线交互式控制台,但问题是我想在我的本地机器上,在 XAMPP.

创建的本地服务器上进行操作

我有这个简单的代码:

import time

t0 = time.time()
for i in range(1000000):
    a = 1
print("assignment.py", time.time()-t0)

如何使用 Skulpt 在我的本地服务器上 运行 简单网页 index.html 上?

这是答案。

<html> 
<head> 
<meta charset="utf-8">
<title>Skulpt</title>
<script src="skulpt.min.js" type="text/javascript"></script> 
<script src="skulpt-stdlib.js" type="text/javascript"></script> 
</head> 
<body> 
</body> 
</html>

要包含 index.html 的文件夹,您必须添加 2 个文件:

skulpt.min.js

skulpt-stdlib.js