Mar-23-2020, 08:44 PM
Hi
I am learning python flask and trying to generate html from python list of tuples using pandas dataframe and to_html method
(refer https://pandas.pydata.org/pandas-docs/ve..._html.html)
here is my python code
<html>
<head>
<title>Reports</title>
</head>
<body>
<h1>Reports Testing</h1><br>
{{ output }}
</body>
</html>
When I execute this, the "output" result gets printed as a continous string instead of a table..whereas if I paste directly via https://html5-editor.net/ ..I see the table printed
can anyone guide me here what I am doing wrong ?
Thanks
Shan
I am learning python flask and trying to generate html from python list of tuples using pandas dataframe and to_html method
(refer https://pandas.pydata.org/pandas-docs/ve..._html.html)
here is my python code
output = [('inst1','insttype1','instregion1','instname1',insttime1'),('inst2','insttype2','instregion2','instname2',insttime2')] df = pd.DataFrame(output, columns=['Instance-Id', 'Instance-Type', 'Region', 'Instance-Name', 'Instane-Launch-Time']) htmls = df.to_html(classes="reports") return htmlshere is my python flask and template code
@app.route("reports", methods = ['POST']) def reports(): result = t1.getEC2(profilename=request.form['awsprofile']) return render_template('output.html', output=result)<!DOCTYPE html>
<html>
<head>
<title>Reports</title>
</head>
<body>
<h1>Reports Testing</h1><br>
{{ output }}
</body>
</html>
When I execute this, the "output" result gets printed as a continous string instead of a table..whereas if I paste directly via https://html5-editor.net/ ..I see the table printed
can anyone guide me here what I am doing wrong ?
Thanks
Shan