Back to Demo

Hello World Python Code

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Hello World Python</title>
    <link rel="icon" type="image/png" href="../../../favicon.png">
    <script defer src="../../../pyscript/pyscript.js"></script>
    <link rel="stylesheet" href="hello_world.css">
</head>
<body>
<py-config src="../py_config.toml"></py-config>
<main>
    <h1>Hello Python ...</h1>
    <div id="output"></div>
    <py-script src="./hello_world.py"></py-script>
</main>
</body>
</html>

hello_world.py

"""Say Hello."""
output = Element("output")  # type: ignore
output.write("From Python...")

hello_world.css

h1 {
}

hello_world.js

/* Stuff here */