import urllib #urlib url = 'http://www.meizitu.com' html = urllib.urlopen(url) print html.read().decode('gbk').encode('utf-8') print dir(urllib.urlopen) print html.info() urllib.urlretrieve(url,"D:\\BaiduNetdiskDownload\\a.text")
import urllib url = 'http://www.meizitu.com' html = urllib.urlopen(url) code = html.getcode() if code ==200: print html.read().decode('gbk','ignore').encode('utf-8') print html.info() urllib.urlretrieve(url, "D:\\BaiduNetdiskDownload\\a.text") else: print '404'