Run Python inside your HTML

Made with JavaScript!

Run Python inside your HTML

PyScript is a framework that allows users to create and run Python in the browser using the HTML interface.

PyScript aims to provide users with a first-class programming language that has consistent style rules, is more expressive, and is easier to learn.


To implement it is very easy, just include the CDN of CSS and JavaScript in your code HTML, example:

<link rel="stylesheet" href="" />
<script defer src=""></script>

And then just use the Python code between the <py-script> tags, for example:

<py-script> print('Hello, Python!') </py-script>

You may notice some slowness, if you want it to be a little faster, please download the files and link locally:


And the full HTML code here:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="./pyscript.css" />
    <py-script> print('Hello, PyScript!') </py-script>
    <script defer src="./pyscript.js"></script>

For more information visit the PyScript official website .

python html