|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
出现以下错误,代码和小甲鱼老师的一模一样,求这是什么问题?打不开网页
请输入城市:上海
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\天气查询\天气查询.py", line 9, in <module>
File1 =urllib.request.urlopen('http://m.weather.com.cn/data/'+name1+'.html')#打开url
File "D:\python\lib\urllib\request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "D:\python\lib\urllib\request.py", line 472, in open
response = meth(req, response)
File "D:\python\lib\urllib\request.py", line 582, in http_response
'http', request, response, code, msg, hdrs)
File "D:\python\lib\urllib\request.py", line 510, in error
return self._call_chain(*args)
File "D:\python\lib\urllib\request.py", line 444, in _call_chain
result = func(*args)
File "D:\python\lib\urllib\request.py", line 590, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
>>>
这个啊。。。有点棘手啦。等你学到爬虫就会改啦~
给你接口:
http://www.weather.com.cn/weather1d/城市代码.shtml#search
|
|