紧急求救!!!!!!!!!!!!
line =urllib.urlopen(url)
line=line.read()
line=line.replace("\n","").replace("\r","").replace("<br>","")
Memo=Get_Table1(line,r"""<span class=\"f14 lh150\">(.*?)</span>""")#公司名称
上页那段代码执行的时候老是报这个错,很没有规律,特向各位高手求救
'NoneType' object has no attribute 'read'
[解决办法]
urllib.urlopen()返回返回了None。是不是网络不太好?
打开log试试:
import httplibhttplib.HTTPConnection.debuglevel = 1import urllibline urllib.urlopen(url)#...