在前端页面中html代码比python多得多,所以一定是html包python最优!于是引出今天的模板。
大体分为三个步骤:
学号 姓名 语文 数学 英语 {% for idx, row in df.iterrows %} {{row.学号}} {{row.姓名}} {{row.语文}} {{row.数学}} {{row.英语}} {% endfor %}
from django.shortcuts import render from django.http import HttpResponse from antproject.settings import BASE_DIR import pandas as pd # Create your views here. def hello(request): return HttpResponse("this is hello/") def show_excel(request): df=pd.read_excel(BASE_DIR / "data/score.xlsx") return render(request,"show_excel.html",{"df":df})
上一篇:cmd查看端口是否开放?
下一篇:从零入手人工智能(6)—— 聚类