Ask coding questions

← Back to all posts
Python output to html
112596 (23)

How would I get output from the code that is running in the console, into the HTML field. I do not need interactivity, nor do I want to embed a Repl Iframe.

IMayBeMe (346)

You can use render_template in flask to export a python variable into HTML and can use it by typing, {{variable_name | safe}} For example:

return render_template(

You would put that in your main flask function

And then to display it you would put:

<p>{{your_variable | safe}}</p>

Hope that helps!

IMayBeMe (346)

@112596 I won't be able to help now but maybe sometime later today.