How to print result of Pyodide in another webpage instead of in console?

381 Views Asked by At

I am using Pyodide to compile python code in the browser. The code below is used to execute the python code in editor and display the result in console. For the errors, I am displaying it using alert() as shown below, and it works just fine. Now, I want to change the behaviour of pyodide to display the result in another webpage. for example: var resultWindow = window.open("resultPage.html"); resultWindow.document.write(output);.

function compilerResult() {
    try {
        pyodide.runPython(editor.doc.getValue())
    } catch(err) {
        alert(err)
    }
}
0

There are 0 best solutions below