擅长:python、mysql、java
<p>您应该使用列表理解使代码更具python风格:</p>
<pre><code># A list of tuples
theData = [(q,requests.get(theURLs[q]).text) for q in range(0, len(theURLs))]
# ... or ...
# A list of lists
theData = [[q,requests.get(theURLs[q]).text] for q in range(0, len(theURLs))]
</code></pre>
<p>如果您想同时使用<code>threading</code>库检索文件,本网站提供了一些很好的示例,可能是一种很好的做法:</p>
<p><a href="http://www.tutorialspoint.com/python/python_multithreading.htm" rel="nofollow">http://www.tutorialspoint.com/python/python_multithreading.htm</a></p>