问题描述
嗨
我从2.4.2升级到python 2.4.3。
我想从谷歌新闻中获取一些原子提要,其功能如同
这个
import urllib2
def takefeed(url):
request = urllib2.Request(url)
request.add_header(''User-Agent'',''Mozilla / 4.0(兼容; MSIE 5.5;
Windows NT'')
揭幕战= urllib2.build_opener()
data = opener.open(request).read()
返回数据
url =''http: //news.google.it/?output=rss''
d = takefeed(url)
这与python 2.3.5很好用,但不适用于2.4。 3.
为什么?
谢谢
定义woks [sic] well。它在2.4.3上工作正常(并且通过工作
罚款我的意思是它没有例外地运行它返回了出现的
是RSS数据) 。如果你给我们一个例外追踪,它会帮助你多付b $ b。
也许Google的服务器(或你的ISP)已经关闭了。发生这种情况
有时候。
Carl
定义不起作用。
- -
$ b $bRenéPijlman
hi
I made the upgrade to python 2.4.3 from 2.4.2.
I want to take from google news some atom feeds with a funtion like
this
import urllib2
def takefeed(url):
request=urllib2.Request(url)
request.add_header(''User-Agent'', ''Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT'')
opener = urllib2.build_opener()
data=opener.open(request).read()
return data
url=''http://news.google.it/?output=rss''
d=takefeed(url)
This woks well with python 2.3.5 but does not work with 2.4.3.
Why?
Thanks
Define "woks [sic] well". It works fine for me on 2.4.3 (and by "works
fine" I mean it ran without an exception and it returned what appeared
to be RSS data). If you would give us an exception trace it would help
a lot.
Maybe Google''s server (or your ISP''s) was down. That happens
sometimes.
Carl
Define "does not work".
--
René Pijlman
这篇关于为什么不在python 2.4.3中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!