<p>我试图检查某些元素是否在一个列表中,并执行数字更新,但我不断得到一个错误(如下)。你知道吗</p>
<hr/>
<pre><code>"if h2output[1] not in h1output == True or h2output[2] not in h1output == True:
IndexError: list index out of range"
</code></pre>
<hr/>
<pre><code>doublewin = 0
h1output = []
h2output = []
h3output = []
v1output = []
v2output = []
v3output = []
d1output = []
d2output = []
for i in h1:
if i not in h1output:
h1output.append(i)
if len(h1output) == 2:
doublewin += 1
for i in h2:
if i not in h2output:
h2output.append(i)
if len(h2output) == 2:
if h2output[1] not in h1output == True or h2output[2] not in h1output == True:
doublewin += 1
</code></pre>