皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【单选题】
不重复访问网站,使用栈的程序from bs4 import BeautifulSoupimport urllib.requestclass Stack: def __init__(self): self.st=[] def pop(self): return self.st.pop() def push(self,obj): self.st.append(obj) def empty(self): return len(self.st)==0def spider(url): global urls stack=Stack() stack.push(url) while not stack.empty(): url=stack.pop() if url not in urls: _______________________ try: data=urllib.request.urlopen(url) data=data.read() data=data.decode() soup=BeautifulSoup(data,"lxml") print(soup.find("h3").text) links=soup.select("a") for i in _______________________: href=links[i]["href"] url=start_url+"/"+href stack.push(url) except Exception as err: print(err)start_url="http://127.0.0.1:5000"urls=[]spider(start_url)print("The End")
A.
urls.append(url); range(len(links),-1,-1)
B.
urls.append(url); range(len(links)-1,0,-1)
C.
urls.insert(url,0); range(len(links)-1,-1,-1)
D.
urls.append(url); range(len(links)-1,-1,-1)
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】The more he tried to help her,____________she seemed to appreciate it.
A.
less
B.
the less
C.
the least
D.
the lesser
【简答题】android声明含有10个String对象的数组的方法是 [填空(1)]
【单选题】链传动主动轮转速为每分钟6000转,从动轮转速为每分钟500转,平均传动比为( )
A.
11
B.
12
C.
0.5
【单选题】作为行为规范,道德和法律的区别表现在( )
A.
道德的作用没有法律大
B.
道德规范比法律规范含糊
C.
道德规范与法律的作用范围不同
D.
道德与法律不能共同起作用
【单选题】The more he tried to help her, _____ she seemed to appreciate it.
A.
less
B.
lesser
C.
the less
D.
the lessser
【判断题】马克思主要研究的是经济异化,存在主义主要研究的是社会异化。()
A.
正确
B.
错误
【简答题】android声明含有10个String对象的数组的方法是[填空(1)]
【单选题】When I turned to Tony for help, I found that the more he tried to explain, ___________.
A.
the more I became confused.
B.
the more confused became I
C.
the more confused I became
D.
I became more confused.
【单选题】The more he tried to please her, _____ she seemed to appreciate it.
A.
less
B.
lesser
C.
the less
D.
A. the lesser
【单选题】下列选项中正确的是()
A.
一个项目具有明确的目标而周期不限
B.
一个项目一旦确定就不会变更
C.
每个项目都有自己的独特性
D.
项目都是一次性的并由项目经理独自完成
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题