from bs4 import BeautifulSoupdoc='''The Dormouse's storyElsieLacieTillie'''def myFilter(tag): print(tag.name) __________________________________________soup=BeautifulSoup(doc,"lxml")tag=soup.find_all(myFilter)print(tag)缺失的语句是: - 快搜搜题库"/> from bs4 import BeautifulSoupdoc='''The Dormouse's storyElsie
请在 下方输入 要搜索的题目:

我们查找文档中的href="http://example.com/lacie"的节点元素<a>from bs4 import BeautifulSoupdoc='''<html><head><title>The Dormouse's story</title></head><body><a href="http://example.com/elsie" >Elsie</a><a href="http://example.com/lacie" >Lacie</a><a href="http://example.com/tillie" >Tillie</a></body></html>'''def myFilter(tag): print(tag.name) __________________________________________soup=BeautifulSoup(doc,"lxml")tag=soup.find_all(myFilter)print(tag)缺失的语句是:


A、return (tag.name=="a" and tag["href"]=="http://example.com/lacie");

B、return (tag.name=="a" and tag.has_attr("href") and tag["href"]=="http://example.com/lacie");

C、return (tag.name=="a" and tag.has_attr("href") and tag.href=="http://example.com/lacie");

D、return (tag.name=="a" and tag.href=="http://example.com/lacie")

发布时间:2025-02-18 01:06:09
推荐参考答案 ( 由 快搜搜题库 官方老师解答 )
联系客服
答案:return (tag.name=="a" and tag.has_attr("href") and tag.href=="http://example.com/lacie")
专业技术学习