如题所述
python从mysql数据库提取出来的数据在html里显示
import mysql.connector
con = mysql.connector.connect(host='127.0.0.1',user='root',password='',db='testt')
rel = con.cursor()
rel.execute('select * from school')
val = rel.fetchall()
val = val[0][1]
con.close();
rel.close();
import mysql.connector
con = mysql.connector.connect(host='127.0.0.1',user='root',password='',db='testt')
rel = con.cursor()
rel.execute('select * from school')
val = rel.fetchall()
val = val[0][1]
con.close();
rel.close();
温馨提示:答案为网友推荐,仅供参考