Unsubscribe
Alihuen
alihuen at cpenet.com.ar
Wed Dec 26 18:47:32 EST 2007
More information about the Python-list mailing list
Wed Dec 26 18:47:32 EST 2007
- Previous message (by thread): save gb-2312 web page in a .html file
- Next message (by thread): EUROMEDIA 2008, April 9-11, 2008, FEUP-University of Porto, Portugal - 2nd Call for Papers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
----- Original Message ----- From: "Peter Pei" <yantao at telus.com> Newsgroups: comp.lang.python To: <python-list at python.org> Sent: Wednesday, December 26, 2007 8:22 PM Subject: Re: save gb-2312 web page in a .html file > You must be right, since I tried one page and it worked. But there is > something wrong with this particular page: > http://overseas.btchina.net/?categoryid=-1. When I open the saved file > (with > IE7), it is all messed up. > > url = 'http://overseas.btchina.net/?categoryid=-1' > headers = { 'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 5.5; Windows > NT)' } > req = urllib2.Request(url, None, headers) > page = urllib2.urlopen(req).read() > > htmlfile = open('btchina.html','w') > htmlfile.write(page) > htmlfile.close() > > -- > http://mail.python.org/mailman/listinfo/python-list > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.17.9/1197 - Release Date: > 25/12/2007 20:04 > >
- Previous message (by thread): save gb-2312 web page in a .html file
- Next message (by thread): EUROMEDIA 2008, April 9-11, 2008, FEUP-University of Porto, Portugal - 2nd Call for Papers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list