JavaScript? Start PyScript now in your HTML

PyScript is a meta project that aims to combine multiple open technologies into a framework that allows users to create sophisticated browser applications with Python. It integrates seamlessly with the way the DOM works in the browser and allows users to add Python logic in a way that feels natural both to web and Python developers.

Try PyScript

<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
  • <py-script>: can be used to define python code that is executable within the web page. The element itself is not rendered to the page and is only used to add logic
  • <py-repl>: creates a REPL component that is rendered to the page as a code editor and allows users to write executable code

New Version Has a Better Initialization EX

HTML

<div id="temp_test">
<h3>wait</h3>
</div>

PyScript

    <py-script output="temp_test">
import pandas as pd
a = pd.read_csv('./test.csv')
a
</py-script>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
- pandas
- paths:
- ./test.csv
</py-env>
<py-script>
from datetime import datetime
now = datetime.now()
now
</py-script>
<div>
<py-repl id="my-repl" auto-generate="true"></py-repl>
</div>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store