Function 无原因的无效语法
我不明白为什么我一直收到无效的语法。以下是我无法理解的函数:Function 无原因的无效语法,function,python-3.x,syntax-error,Function,Python 3.x,Syntax Error,我不明白为什么我一直收到无效的语法。以下是我无法理解的函数: 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
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()
试着把所有东西缩进。
“coordType”的主体与标题位于同一位置,因此在python中无效。无效语法错误应该告诉您它在哪一行找到它。看那一行或旁边的一行。你第二行的结尾怎么样?问题是第二行的布拉肯特。我想补充一点,您忘了在第三行的coordType.lower中添加括号对不起,请再次查看帖子