I'm writing a website using Python flask. It has to read a csv file (an excel file saved as csv), do some calculations there, and I need to show the actual table and the results on the website. How do I write the functions in the html file? I need to write them in the places where it says "some table". here's my html file:
<!doctype html>
<html lang="ru">
<link rel="stylesheet" href="">
<div class="container">
<nav class="navbar">
<ul>
<li><a href="#table">first</a></li>
<li><a href="#problems">second</a></li>
<li><a href="#rank">third</a></li>
<li><a href="#cheated">forth</a></li>
</ul>
</nav>
<section id="table">
<h1>1</h1>
<p class="lead"> some table</p>
</section>
<section id="problems">
<h1>2</h1>
<p class="lead">some table</p>
</section>
<section id="rank">
<h1>3</h1>
<p class="lead">some table</p>
</section>
<section id="cheated">
<h1>4</h1>
<p class="lead">some table</p>
</section>
</div>
</html>
here's my py file
from flask import Flask, render_template
from flask import url_for
from flask import make_response, request, redirect
import io
import csv
from io import TextIOWrapper
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
with open('testfinal.csv', 'r') as csv_file:
csv_reader = csv.reader(csv_file)
print(csv_reader)
@app.route('/')
def about():
return render_template("about.html")
if __name__ == "__main__":
app.run(debug=True)
Aucun commentaire:
Enregistrer un commentaire