为什么运行结果为空??真的很急
# -*- coding: UTF-8 -*-
import urllib2
class HtmlDownloader(object):
def download(self, url):
if url is None:
return None
response = urllib2.urlopen(url)
if response.getcode() != 200:
return None
return response.read()
s=HtmlDownloader()
s.download("http://xiaoshuo.sogou.com/book/11_493239/")
运行结果: