このコード:
def viewdetails():
os.system('cls')
print "|__________________________________________|"
print "|----------------View Details--------------|"
print "|------------------------------------------|"
print "|1 - Search with Customer ID |"
print "|2 - Search with Telephone number |"
print "|------------------------------------------|"
choice = raw_input("|Choice: ")
if choice == "1":
while True:
IDSearch = raw_input("|What is their ID? : ")
conn = sqlite3.connect('SADS.db')
cur = conn.cursor()
cur.execute("SELECT * FROM customers WHERE CustID = (?)",(IDSearch,))
row = cur.fetchone()
if row[0] != IDSearch:
print "|------------------------------------------|"
print "| Invalid ID, Try again! |"
print "|------------------------------------------|"
else:
break
CustID = row[0]
print "|------------------------------------------|"
print "|Customer ID : " , row[0]
print "|Forename : " , row[1]
print "|Surname : " , row[2]
print "|Address Line 1 : " , row[3]
print "|Address Line 2 : " , row[4]
print "|City : " , row[5]
print "|Postcode : " , row[6]
print "|Telephone number : " , row[7]
print "|E-Mail : " , row[8]
while True:
print '|Do you want to see what seats', row[1], 'has booked?|'
choice = raw_input("|Y/N: ")
if choice == 'Y':
cur.execute("SELECT * FROM seats WHERE CustID = (?)", (CustID,))
rowseat = cur.fetchone()
if rowseat:
print "|Seats booked:" , rowseat[0]
print "|------------------------------------------|"
break
else:
print "|" , row[1] , "Hasnt booked any seats."
break
print(" ")
print "|------------------------------------------|"
print("|Please select an option: |")
print("|1 - Return to menu |")
print("|2 - Book seats |")
print("|3 - Edit details |")
choice = raw_input("|Please put choice here : ")
print "|------------------------------------------|"
elif choice == "2":
while True:
IDSearch = raw_input("|What is their ID? : ")
conn = sqlite3.connect('SADS.db')
cur = conn.cursor()
cur.execute("SELECT * FROM customers WHERE CustID = (?)",(IDSearch,))
row = cur.fetchone()
if row[0] != IDSearch:
print "|------------------------------------------|"
print "| Invalid ID, Try again! |"
print "|------------------------------------------|"
else:
break
CustID = row[0]
print "|------------------------------------------|"
print "|Customer ID : " , row[0]
print "|Forename : " , row[1]
print "|Surname : " , row[2]
print "|Address Line 1 : " , row[3]
print "|Address Line 2 : " , row[4]
print "|City : " , row[5]
print "|Postcode : " , row[6]
print "|Telephone number : " , row[7]
print "|E-Mail : " , row[8]
while True:
print '|Do you want to see what seats', row[1], 'has booked?|'
choice = raw_input("|Y/N: ")
if choice == 'Y':
cur.execute("SELECT * FROM seats WHERE CustID = (?)", (CustID,))
rowseat = cur.fetchone()
if rowseat:
print "|Seats booked:" , rowseat[0]
print "|------------------------------------------|"
break
else:
print "|" , row[1] , "Hasnt booked any seats."
break
print(" ")
print "|------------------------------------------|"
print("|Please select an option: |")
print("|1 - Return to menu |")
print("|2 - Book seats |")
print("|3 - Edit details |")
choice = raw_input("|Please put choice here : ")
print "|------------------------------------------|"
print(" ")
print "|------------------------------------------|"
print("|Please select an option: |")
print("|1 - Return to menu |")
print("|2 - Book seats |")
print("|3 - Edit details |")
choice = raw_input("|Please put choice here : ")
print "|------------------------------------------|"
if choice == "1":
mainprogram()
elif choice == "2":
availablity()
elif choice == "3":
editdetails()
os.system('cls')
viewdetails()
(http://pastebin.com/X62jRLiL)
elifステートメントを取得することはelif choice == "2":
明らかに無効な構文ですが、elif choice == "1":
動作し、次のコードは互いに正確に複製されていますか?