2017-03-18 75 views
0

我找不出爲什麼我一直在接收無效的語法。這裏是我無法弄清楚的功能:無端語法無效

def coordType(): 
    coordType = input("Automatic [a] or manual [m] message box coordinates?" 
    if coordType.lower not in ("a", "m"): 
     print("It must be 'a' or 'm'") 
     coordType() 
    elif coordType.lower() == "a": 
     print("Please put your mouse over the message box") 
     time.sleep(5) 
     xc, yc = m.position() 
     print("Done - " + str(xc) + ", " + str(yc)) 
    elif coordType.lower() == "m": 
     xcoord() 
     ycoord() 
+1

無效的語法錯誤應該告訴你它在哪一行找到它。看那條線或旁邊的一條線。那你在第二行的結尾是什麼? –

+1

問題是第二行中的括號。我想補充一點,你忘了在第三行 – megamit

+0

@megamit中添加括號到coordType.lower謝謝! –

回答

0

嘗試縮進一切。 「coordType」的主體與標題相同,所以它在python中無效。

+0

對不起,請再次查看帖子 –