这是我目前用python编写的代码的一小部分,系统在else块中打印的'p'处给我一个无效语法错误。
def bookticket():
enteredname=name.get()
enteredage=age.get()
enteredgender=selectedgender.get()
enteredtime=selectedtime.get()
enteredfrom=selectedfrom.get()
enteredto=selectedto.get()
enteredemail=email.get()
if (enteredname=="") or (enteredage=="") or (enteredemail==""):
messagebox.showerror("ERROR","YOU SEEMED TO HAVE MISSED SOME DETAIL")
else:
entereddate=str(selecteddateday.get())+" "+selecteddatemonth.get()+"
"+selecteddateyear.get()
ticketno=random.randrange(10000,99999)
ticketnolabel=Label(book,text="YOUR TICKET NUMBER IS:n"+str(ticketno),font=allfont).grid(row=5,column=6,columnspan=3)
pleasenotelabel=Label(book,text="PLEASE MAKE NOTE OF TICKET
NUMBER",font=allfont).grid(row=6,column=6,columnspan=5)
ticketcommand=("insert into details values ('"+enteredname+"','"+enteredage+"','"+enteredgender+"','"+enteredfrom+"','"+enteredto+"','"+entereddate+"','"+enteredtime+"','"+ticketprice+"','"+str(ticketno)+"','"+str(enteredemail+"');")
print(ticketcommand)
cursor.execute(ticketcommand)
con.commit()
str(enteredemail)
的结束)
在前一行中丢失。
ticketcommand=("insert into details values ('"+enteredname+"','"+enteredage+"','"+enteredgender+"','"+enteredfrom+"','"+enteredto+"','"+entereddate+"','"+enteredtime+"','"+ticketprice+"','"+str(ticketno)+"','"+str(enteredemail)+"');")