Reputation: 679
I'm new to Flask in Python. I've managed to transfer values from my python code to an HTML page. I'm trying to transfer one value which is actually a long paragraph. I have a loop creating this long text:
google_str += num + '. ' + title + '\n' + url + '\n'
I want this to eventually look like this in HTML:
- Title1
URL1- Title2
URL2
etc.
I'm sending it to HTML like this:
return render_template('searchtool.html', google_str = google_str)
But then I see the text as one big paragraph without the new lines. How can this be solved?
Upvotes: 1
Views: 1238
Reputation: 679
Found what I was looking for.
First, I had to use "< br >" instead of '/n'. Second, use this in my HTML:
{{google_str|safe}}
This is where I found the answer.
Upvotes: 1