H
H
Hello World2019-07-05 16:22:39
Python
Hello World, 2019-07-05 16:22:39

Why are html codes not showing up?

I wrote a simple template:

<html>
<head><title>Test</title></head>
<body>
{% for string in string_array %}
<div> {{string}}</div>
{% endfor %}
</body>
</html>

app.py
from flask import Flask, request, render_template

app = Flask(__name__)
@app.route('/')
def main():
    string_array = ['text 1', '&#34;&#34;']
    return render_template(path, string_array=string_array)

And instead
text 1
""

Displays
text 1
&#34;&#34;

How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hello World, 2019-07-05
@hello-world00

Thanks Google, sorry for the question.
{{ string|safe }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question