Pyodide and print redirected to div

39 views Asked by At

Pyodide is properly installed as explained here: https://pyodide.org/en/stable/usage/quickstart.html

I try to get the result of

for i in range(4):
    print(i)

in a div like:

0
1
2
3

But it only appears in the console log. I have tried await pyodide.globals.set('print', s => document.getElementById("output").innerText += s) but it doesn't work.

0

There are 0 answers