Answer the question
In order to leave comments, you need to log in
How to replace newline character with tag?
Thanks in advance for your replies
. I'm writing a Flask app with a simple message input form. The message is entered and stored in the database. But the whole message is obtained in one line.
Please tell me how, when displaying a message, translate newline characters ("\r\n", "\r", "\n") into the tag
# model.py (model in the database)
class Post(db.Model):
__tablename__ = 'posts'
id = db.Column(db.Integer, primary_key=True)
body = db.Column(db.Text)
<html>
<head>
<title>WWW Site</title>
</head>
<body>
{{ post.body }}
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question