我用下面的代碼else語句檢查某些條件如果在for循環中不能正常工作
for myarg in myargs:
if myarg=='heading.png':
t = find(dirpath + '\\' + myarg)
t1= capture(t.getX() - 50, t.getY() + 50, t.getW(), t.getH())
click(t1)
else
print "else inside-----------"
myargs
conatians heading.png,name.png etc
在執行上面的代碼時
gettign誤差修改IndentationError: unindent does not match any outer indentation level
在你的問題中,你的縮進在很多地方都是錯誤的。 – sshashank124
在Python中,一切都必須正確縮進,因爲錯誤告訴你。 'if'塊之後的所有內容應該處於相同的縮進位置,直到else塊,此時'else'之後的塊應該等同於'if'塊 – ydaetskcoR
':'在每個塊初始化之後被請求,包括'else' – Trimax