- 帖子
- 18
- 精华
- 0
- 积分
- 132
- 阅读权限
- 20
- 注册时间
- 2013-7-25
- 最后登录
- 2013-12-3
|
crossin先生 发表于 2013-9-2 18:51
很可能是,查询多了,对方服务器有时候没有回复成功。
你把contect4打出来看看,错的时候是什么数据 ...
试了5次,有3次是放回一张html文件的源代码,应该是长404页面,
<div class="main">
<h1>很抱歉,您要访问的页面不存在。</h1>
<p>请直接点击下面的连接进入中国天气网首页:<a href="http://www.weather.com.cn/">www.weather.com.cn</a></p>
<div class="ewm">
<h3><a href="http://3g.weather.com.cn/">中国天气网客户端</a></h3>
<dl>
<dt><a href="http://3g.weather.com.cn/"><img src="/poster/chart.png"></a></dt>
<dd><a href="http://3g.weather.com.cn/">点击或扫描下载</a></dd>
</dl>
</div>
</div>
有2次是返回下面的报错:
Traceback (most recent call last):
File "/Users/aresli/Sites/Dropbox/file/python/lesson46.py", line 33, in <module>
content4 = urllib2.urlopen(url4).read()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default
urllib2.HTTPError: HTTP Error 404: Not Found
是不是网络问题或者是中国天气网的数据问题? |
|