Here is my sample flask code,
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def root():
report = ["str1 1\n"," str2 2"]
report = "".join(report)
report = report.replace('\n', '<br>')
return render_template('detailed_report.html', report = report)
app.run(debug=True)
Here is my corresponding HTML code,
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index</title>
</head>
<body>
<div>
{% autoescape false %}
{{report}}
{% endautoescape %}
</div>
</body>
</html>
Expected result:
str1 1
str2 2
Actual result:
str1 1
str2 2
What should I do to preserve the space? Thanks in advance :)