我if語句有這個問題這段代碼爲什麼會產生語法錯誤?
while True:
try:
continue_shopping=int(input("press 0 to stop shopping and print your reciept or press 1 to continue shopping"))
if continue_shopping !=0 and continue_shopping !=1:
print(" make sure you enter 0 or 1")
if continue_shopping !=1
keep_searching = False
if (continue_shopping == 0):
fileOne.close()
fileTwo = open("receipt.csv" , "r")
reader = csv.reader(fileTwo)
for row in reader:
if row != None:
print(row)
elif continue_shopping==1:
search_user_input()
quantity()
quantity()
第五行產生一個無效的語法錯誤「如果」以紅色突出顯示,我不確定這是爲什麼
你忘了「:」在條件 – N0un
結束時,您不能使用'試穿if'條款 –
旁邊的語法錯誤:Python的需要適當的縮進。 try:塊中的所有代碼都需要一個idont indenation。 keep_searching = False。 – RvdK