擅长:python、mysql、java
<p>不,这不是Python能力的限制。你知道吗</p>
<p>相反,您在代码中犯了一个错误。你知道吗</p>
<p>你会注意到你的错误是:</p>
<blockquote>
<p><code>IndexError: list assignment index out of range</code></p>
</blockquote>
<p>注意<em>列表赋值</em>工件。您正在尝试将x分配给列表中尚不存在的索引。当你做<code>dd [x] = x</code>。你知道吗</p>
<p>相反,只需将x附加到带有<a href="https://docs.python.org/3.5/tutorial/datastructures.html" rel="nofollow">^{<cd2>}</a>的列表中</p>
<pre><code>dd = []
for x in range(5592406):
dd.append(x)
</code></pre>
<p>虽然这是可行的,但是它很麻烦,而且可以更容易地用<a href="https://docs.python.org/3.5/tutorial/datastructures.html#list-comprehensions" rel="nofollow">list comprehension</a>在一行中完成。你知道吗</p>
<pre><code>dd = [x for x in range(5592406)]
</code></pre>