用户名包含敏感 发表于 2016-10-10 20:27:17

询问

'NoneType' object has no attribute 'read'
这个是什么情况,读取网页的时候出现的

def url_open(url):
    req=urllib.request.Request(url)
    response=urllib.request.urlopen(url)
def get_page(url):
    html=url_open(url).read()

还有这个find也是会出现
'NoneType' object has no attribute 'find'

a=html.find('img src=')

lili200238 发表于 2016-10-11 16:34:58

这用户名{:7_141:}

冬雪雪冬 发表于 2016-10-11 22:18:17

def url_open(url):返回None,没有read方法
页: [1]
查看完整版本: 询问