如果我运行这段代码,它会被正确分页,没有任何错误builtins.IndexError IndexError: single positional indexer out of bounds “错误,我完全理解 intenettene 解析,你有帮助吗?当我看相关文章时,我没有了解其中一些的解决方案,但有些不明白,因为他们不是土耳其语,你能帮我吗?from flask import Flask,render_template,flash,redirect,url_for,session,logging,requestfrom flask_mysqldb import MySQLfrom wtforms import Form,StringField,TextAreaField,PasswordField,validatorsfrom passlib.hash import sha256_cryptfrom functools import wrapsimport pandas as pdimport randomimport timeimport sysapp = Flask(__name__)app.secret_key= "ybblog"app.config["MYSQL_HOST"] = "localhost"app.config["MYSQL_USER"] = "root"app.config["MYSQL_PASSWORD"] = ""app.config["MYSQL_DB"] = "ybblog"app.config["MYSQL_CURSORCLASS"] = "DictCursor"mysql = MySQL(app)@app.route("/")def index(): return render_template("site.html")@app.route("/maps")def about(): return render_template("maps.html")#Atama Url@app.route("/sonuc",methods=["GET","POST"])def sonuc(): cursor = mysql.connection.cursor() sorgu = "Select * From site" result = cursor.execute(sorgu) if result >0: articles = cursor.fetchall() cursor.execute("DELETE FROM site") mysql.connection.commit() cursor.close() return render_template("sonuc.html",articles= articles) else: cursor.execute("DELETE FROM site") mysql.connection.commit() cursor.close() return render_template("site.html") cursor.execute("DELETE FROM site") mysql.connection.commit() cursor.close()
添加回答
举报
0/150
提交
取消