官网
总结
可以直接在浏览器中运行python代码,并且可以使用很多python生态中的库,十分方便。但是目前测试效果还不好,运行起来渲染比较慢。
示例代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>python代码直接运行到浏览器中</title>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
<py-script>
count = 0
while (count < 9):
print('The count is:', count)
count = count + 1
</py-script>|
</body>
</html>