I am using this code, which (most of the times, because it is different everytime) prints multiple lines of strings.
if request.method == "POST":
d = {'Dirt 4': g_dirt4, 'Destiny 2': g_destiny2, 'South Park: The Fractured but Whole': g_southpark, 'Call of Duty: WWII': g_codww2, 'Star Wars Battlefront II': g_bfront2, 'Red Dead Redemption 2': g_reddead2, 'FIFA 18': g_fifa18, 'MotoGP™17': g_motogp17, 'The Elder Scrolls Online: Morrowind': g_elderscrolls, 'Crash Bandicoot N. Sane Trilogy': g_crashbandicoot}
max_value = max(d.values())
maximal_keys = [ k for k,v in d.items() if v==max_value ]
for title in maximal_keys:
print (title)
return render_template("result_page.html", title=title)
So this means, when you click on a button, it will return the result_page.html and in the html code, the title variable will be replaced with the actual title. So this is the html code:
<body>
This game(s) belongs to you: {{ title }}
</body>
When the python code prints something it looks like this, but like I said it is different sometimes:
2017-06-14 07:08:22 Destiny 2
2017-06-14 07:08:22 Call of Duty: WWII
The problem is that when I click the button in this case, it will only change the title to Destiny 2. I won't get multiple lines of titles like I want. How do I do that?
So now in this case it will show me:
But I would like to see this:
{% for n in title %}- {{n}}
{% endfor %}
– Anup Jun 14 '17 at 14:13