PyScript让你可以在 html 里写 Python ,感觉很有趣。
比如下面这个图(大概要等5分钟😂):
<div id="plot"></div>
<py-script output="plot">
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(1000)
y = np.random.randn(1000)
fig, ax = plt.subplots()
ax.scatter(x, y)
fig
</py-script>
Loading...
REPL
Console log: