I think a clean way is with Flask and Jinja on client side,demo under.
Other ways as you may know so do not Python execute in in browser,as JavaScript dos.
There are several projects that compile Python to JS.
List of project that compile to JS.
Flak demo,so on server i can have a lazy evaluated
app.py:
Other ways as you may know so do not Python execute in in browser,as JavaScript dos.
There are several projects that compile Python to JS.
List of project that compile to JS.
Flak demo,so on server i can have a lazy evaluated
lst
,that get evaluated on client with Jinja app.py:
from flask import Flask, render_template app = Flask(__name__) @app.route('/') def num_list(): lst = range(0, 11) return render_template("index.html", lst=lst) if __name__ == "__main__": app.run(debug=True)index html.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Page Title</title> </head> <body> {% for item in lst %} <p> {{ item }} </p> {% endfor %} </body> </html>
λ python app.py * Serving Flask app "app" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: on * Restarting with stat * Debugger is active! * Debugger PIN: 334-187-997 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)