why not in python 2.4.3

John Machin sjmachin at lexicon.net
Tue May 30 03:19:55 CEST 2006


On 30/05/2006 12:44 AM, Rocco wrote:
> Thanks Serge.
> It's a gzip string.

Look, Ma, no gzip!!!

C:\junk>rocco_rss.py
'<?xml version="1.0" encoding="UTF-8"?><rss 
version="2.0"><channel><generator>NF
E/1.0</generator><tit'

C:\junk>type rocco_rss.py
import urllib2
def takefeed(url):
         request=urllib2.Request(url)
         request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 
5.5; Win
dows NT')
         opener = urllib2.build_opener()
         data=opener.open(request).read()
         return data
url='http://news.google.it/?output=rss'
d=takefeed(url)
print repr(d[:100])



More information about the Python-list mailing list