X
B
<span>
C
</span>
D
" soup=BeautifulSoup(doc,"lxml") print(soup.prettify()) tags=soup.select("div ~ p") for tag in tags: print(tag) print() tags=soup.select("div + p") for tag in tags: print(tag) 结果是
A、
B
;
D
B、
B
;
C
C、
C
;
D
D、
D
;
C
第1题
X
B
<span>
C
</span>
D
" soup=BeautifulSoup(doc,"lxml") print(soup.prettify()) tags=soup.select("div ~ p") for tag in tags: print(tag) print() tags=soup.select("div + p") for tag in tags: print(tag) 结果是
A、
B
;
D
B、
B
;
C
C、
C
;
D
D、
D
;
C
第5题
The Dormouse's story
</book></book></book></book></book></bookstore></selector></selector></selector></selector></selector></selector></class></class></selector></selector></class></selector></selector></selector></selector></bookstore></body></html></title></generator></selector></selector></selector></selector></bookstore></body></html></title></book></bookstore></body></html>
Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.
...
''' soup=BeautifulSoup(doc,"lxml") ___________________________________ for tag in tags: print(tag) 查找文档中class="sister"的元素,缺失语句是:
A、tags=soup.find(name=None,attrs={"class":"sister"})
B、tags=soup.find(attrs={"class":"sister"})
C、tags=soup.find_all(attrs={"class":"sister"})
D、tags=soup.find_all(name=None,attrs={"class":"sister"})
第6题
The Dormouse's story
Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.
...
''' soup=BeautifulSoup(doc,"lxml") ___________________________________ for tag in tags: print(tag) 查找文档中class="sister"的元素,缺失语句是:
A、tags=soup.find(name=None,attrs={"class":"sister"})
B、tags=soup.find(attrs={"class":"sister"})
C、tags=soup.find_all(attrs={"class":"sister"})
D、tags=soup.find_all(name=None,attrs={"class":"sister"})
第7题
The Dormouse's story
Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.
...
''' soup=BeautifulSoup(doc,"lxml") _______________________________ print(tag) 程序结果找到class="story"的
元素,缺失的语句是
A、tag=soup.find("p",attrs={"class":"story"})
B、tag=soup.find("p",attr={"class":"story"})
C、tag=soup.find("p")
D、tag=soup.find("p",class="story")
第8题
The Dormouse's story
Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.
...
''' soup=BeautifulSoup(doc,"lxml") ______________________________________ for tag in tags: print(tag["href"]) 结果是: http://example.com/elsie http://example.com/lacie http://example.com/tillie 缺失的语句是:
A、tags=soup.select("pa")
B、tags=soup.select("p[] a")
C、tags=soup.select("p[class]>a")
D、tags=soup.select("p[class='story'] a")
第10题
The Dormouse's story
Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.
...
''' soup=BeautifulSoup(doc,"lxml") ______________________ for tag in tags: _________________ 缺失的语句是:
A、tags=soup.find_all("a");print(tag.href)
B、tags=soup.find_all("a");print(tag("href"))
C、tags=soup.find("a");print(tag["href"]);
D、tags=soup.find("a");print(tag.("href"))
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!