我正试图在屏幕上查找对象,看看它们是否存在,如果有,请选择它们。使用Sikuli库运行这个小自动化。从多个变量中选择
while True:
if exist("image/one.png", "image/two.png", "image/three.png"):
click ("image/one.png", or "image/two.png", or "image/three.png")
break
我得到一个SyntaxError: mismatched input 'or' expecting RPAREN
我做了一个快速的搜索,但没有什么,我看到有关我的具体问题。
我甚至试过
while True:
if exist("image/one.png", or "image/two.png", or "image/three.png"):
click ("image/one.png", or "image/two.png", or "image/three.png")
break
而这导致了同样的错误。
@Stephan:错误的新代码片段。
class gameImages():
imageFiles = ["one.png", "two.png", "three,png"]
for imageFile in imageFiles:
if exists(imageFile):
click(imageFile)
现在的错误,:
NameError: name 'imageFiles' is not defined
你为什么把这些'或'放入?你不能在逗号后面加上'或'。你从事什么样的工作? –
如果您用'|'替换'或',该怎么办? – refi64
@DavidRobinson我看到之前做过的事情,不记得在哪里。你是说删除逗号,它应该起作用吗? – Dave