擅长:python、mysql、java
<p>问题不是<code>or</code>,而是结尾的换行。不再有左括号,因此换行符终止<code>if</code>语句;但是,对于解析器,<code>if</code>语句必须以冒号结尾,而您的则不是。在</p>
<p>或者添加一个显式的行延续:</p>
<pre><code>if (counts[straightrunfaces[i]] and
counts[straightrunfaces[i+1]] and
counts[straightrunfaces[i+2]] and
counts[straightrunfaces[i+3]]) or \
(counts[straightrunfaces[i+1]] and
counts[straightrunfaces[i+2]] and
counts[straightrunfaces[i+3]] and
counts[straightrunfaces[i+4]]):
</code></pre>
<p>或者用括号括起来:</p>
^{pr2}$
<p><a href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a>推荐后者。在</p>