python - 为什么这会给出错误 [E0001:invalid syntax ()] 在 python 3 中
问题描述
我试图创建一个 else 语句来检查井字棋棋盘中是否有平局:
#Checking for a tie:
else:
#The board's numbers:
for i in range(1,10):
#If all or the numbers are not on the board, and no one won or lose...
if all(not(i in board):
#...then there's a tie!
print("Tie!")
#If no one loses or won, and there's no tie, then the game isn't over.
else:
pass
Python给说这行有问题:
if all(not(i in board):
这是错误:
E0001:invalid syntax (<string>, line 156)
怎么修线?
解决方案
更改if all(not(i in board):
为if all(not(i in board)):
。
推荐阅读
- esp8266 - Getting Error code -1 (HTTP_CONNECTION_REFUSED) after first connection
- c# - How to Execute a SQL query while a Data Reader is opened?
- macos - Visual Studio team services for Mac
- android - 如何将多个值添加到 Firestore 中的同一字段
- spring-boot - 该类不在受信任的包中,但出现在受信任的包列表中
- java - MediaPlayer noSound OSX
- eclipse - when() not working in RestAssured using eclipse
- android - Refresh wheel freezes until onRefresh() is finished
- scala - 用于包装不纯方法的效果?
- machine-learning - Feture selection when the number features is too large for available memory