This is interesting… Never knew we can put in logics in html tags…
So here is a simple demo…
from flask import Flask, render_template app = Flask(__name__) @app.route('/marvel/') def list_marvel_heroes(): marvel_heroes = [ 'Captain America', 'Spider man', 'Luna Snow', 'Hulk', 'Thor' ] return render_template('marvels.html', heroes = marvel_heroes) if __name__ == '__main__': app.run(debug=True)
The html tags are:
And the result is: