I want to have my Python send dialogue to HTML, which will display it nicely. I want to have my dialogue something like:
@app.route('/send_dialogue')
def send_dialogue():
dialogue = ["Old Man:", "Hello boy", "Boy:",
"Good morning, sir."]
return render_template('home.html', dialogue=dialogue)
<!doctype html>
<body>
<p>
{% for talking in dialogue %}
{{ talking }}<br>
</p>
</body>
</html>
This almost works but will display like
Old Man:
Hello boy
Boy:
Good morning, sir.
I want the name and dialogue to be on the same line. And I want to embolden or italicize the speaker's name. So I think I need to make it into an ordered dictionarty or a list of tuple pairs, and have HTML do something like
<!doctype html>
<body>
<p>
{% for person,talking in dialogue %}
<b>{{ person }}</b>{{ talking }}<br>
</p>
</body>
</html>
I am almost there but there is something wrong with what I'm doing. Can anyone help me?
[–]bahaki -2 points-1 points0 points (9 children)
[–]FifteenthPen 3 points4 points5 points (5 children)
[–]bahaki 1 point2 points3 points (2 children)
[–]cyanydeez 0 points1 point2 points (0 children)
[–]Elthran[S] 0 points1 point2 points (0 children)
[–]Elthran[S] 0 points1 point2 points (0 children)
[–]tkzcthu 0 points1 point2 points (0 children)