How do I add python to my HTML,JS,CSS repl

i am trying to make my website run a Python script file but I can’t find a way to install Python to the repl, how do I do this?
i have tried typing “python” into the shell and telling it to install it but then it puts me in some weird console here and then i press “CTRL+D” to exit the weird shell then type “python” and it asks me if i want to install it again.

I would recommend just making a flask repl, as HTML/CSS/JS repls are different from most other repls.

5 Likes

You can use the Pyscript library to add code in python in your .html files. You can check more about it as their website here

3 Likes

I found some code on the pyodide webiste (pyodide.org), I have never had pyodide work but I have heard good things about it:

<html>
  <head>
      <script src="https://cdn.jsdelivr.net/pyodide/v0.23.1/full/pyodide.js"></script>
  </head>
  <body>
    <script type="text/javascript">
      async function main(){
        let pyodide = await loadPyodide();
        console.log(pyodide.runPython("1 + 2"));
      }
      main();
    </script>
  </body>
</html>

I hope it helps.

1 Like

I think you can do , but I haven’t tested it.

Look here: