def insert_data():
ch="y"
while(ch=="y" or ch=="Y"):
i=0
stu_roll_no=int(input("\n\nENTER THE ROLL NUMBER :"))
q0 = "SELECT * FROM STUDENT where ROLL_NO=?"
cur.execute(q0, (stu_roll_no,))
a=cur.fetchall()
for row in a:
if(stu_roll_no == row[0]):
print("\nTHIS ROLL NUMBER ALREADY EXISTS")
print("\n1.UPDATE THE EXISTING RECORD\n2.INSERT NEW RECORD\nPRESS ANY KEY TO GO BACK")
sel=input("\nENTER CHOICE : ")
if sel=='1':
update_data()
i=1
ch="n"
elif sel=='2':
ch="y"
i=1
else:
admin()
ch="n"
i=1
else:
break
if i!=1:
stu_name=input("ENTER STUDENT NAME :")
father_name=input("ENTER FATHER NAME :")
mobile=input("ENTER THE MOBILE NO :")
while(len(mobile)!=10):
mobile=input("\nPLEASE ENTER 10-DIGIT MOBILE NUMBER :")
stu_mobile_no=int(mobile)
stu_age=int(input("ENTER STUDENT AGE :"))
while(stu_age<=0 or stu_age>=30):
stu_age=int(input("\nENTER CORRECT STUDENT AGE"))
stu_dept=input("ENTER THE DEPARTMENT NAME :")
stu_dept.upper()
exam=input("ENTER EXAMINATION NAME :")
python=int(input("ENTER MARKS IN PYTHON :"))
rdbms=int(input("ENTER MARKS IN RDBMS :"))
cn=int(input("ENTER MARKS IN CN :"))
os=int(input("ENTER MARKS IN OS :"))
ds=int(input("ENTER MARKS IN DS :"))
cur.execute("insert into student (ROLL_NO,NAME,FATHER_NAME,MOBILE_NO,AGE,DEPARTMENT) values (?,?,?,?,?,?)",(stu_roll_no,stu_name,father_name,stu_mobile_no,stu_age,stu_dept))
cur.execute("insert into result (ROLL_NO,EXAMINATION,PYTHON,RDBMS,CN,OS,DS) values (?,?,?,?,?,?,?)",(stu_roll_no,exam,python,rdbms,cn,os,ds))
print("\n\nRECORD ENTERED SUCCESSFULLY")
db.commit()
ch=input("\n\nWANT TO INSERT ANOTHER RECORD ? (Y/N) : ")
我在执行pymysql时遇到问题。
我的计算机正在使用Windows 10, 在蟒蛇上使用python 3.7。
query = query % self._escape_args(args, conn)
TypeError: not all arguments converted during string formatting
mogrify()
上的cursor.py
出现了问题。在这个问题的其他地方,它说与%的过时格式有关,但我没有使用它。
任何建议或修正将不胜感激