I have a python dictionary which stores the HTML title and comments from the user. I want to display each comment on a new line. I'm wondering is there a way to do this through some sort of loop like a while or for? I am displaying it manually for now. I am using flask if that helps. Here is my code:
Python:
with open ("comments.txt", "r") as myfile:
data=myfile.read()
display_information = {
'title':'My title'
'messages':data.split('*')
}
return render_template('test.html', pageinfo=display_information)
HTML:
{{ pageinfo.messages[0] }}
<br>
{{ pageinfo.messages[1] }}
<br>
{{ pageinfo.messages[2] }}
Is there a fast way of displaying the messages on a new line?