Reputation: 289
I am trying to make output like below.
Below is my flask code:
@app.route('/finance')
def finance():
page = requests.get("http://dataquestio.github.io/web-scraping-pages/simple.html")
soup = BeautifulSoup(page.content, 'html.parser')
soup = soup.prettify()
return render_template('finance.html', page=page, soup=soup)
HTML code:
{{ soup }}
How can I achieve the neat format in the first image?
Upvotes: 1
Views: 170
Reputation: 6061
As user Nico Haase mention, you should wrap your code in pre
tag. I tried it locally, it works.
<pre>
{{ soup }}
</pre>
Upvotes: 1