擅长:python、mysql、java
<p>很高兴问题有了答案。
问题在我的<strong>古尔.txt</strong>文件读取时。我将展示以下内容:</p>
<pre><code>>>> with open("wegourl.txt") as ur:
... d=[]
... for url in ur:
... print url
...
http://stackoverflow.com/questions=1
http://stackoverflow.com/questions=2
</code></pre>
<p>毫无疑问,换行引起的空行不是合法的URL,中断了这个脚本。
我可以在读取文件时修改\n just rid of:<code>url=url.strip('\n')</code></p>