题目内容 (请给出正确答案)
[主观题]

htmlText=''' <bookstore> <book id="b1"&...

htmlText=''' <bookstore> <book id="b1"> <title lang="english">Harry Potter</title> <price>29.99</price> </book> <book id="b2"> <title lang="chinese">学习XML</title> <price>39.95</price> </book> </bookstore> ''' selector=Selector(text=htmlText) _________________________________________ print(s) print(s.extract()) for e in s: print(e.extract()) 程序结果: [<selector xpath="//book/@id" data="b1">, <selector xpath="//book/@id" data="b2">] ['b1', 'b2'] b1 b2

A、s=selector.xpath("/book/@id")

B、s=selector.xpath("//book/@id")

C、s=selector.xpath("//book/id")

D、s=selector.xpath("/book/id")

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“htmlText=''' <bookstore> <book…”相关的问题

第1题

htmlText=''' <bookstore> ...

htmlText=''' <bookstore> <book id="b1"> <title lang="english">Harry Potter</title> <price> 29.99 </price> </book> <book id="b2"> <title lang="chinese">学习XML</title> <price> 39.95 </price> </book> </bookstore> ''' selector=Selector(text=htmlText) _________________________________________ print(s) print(s.extract()) for e in s: print(e.extract()) 程序结果: [ <selector xpath="//book/@id" data="b1"> , <selector xpath="//book/@id" data="b2"> ] ['b1', 'b2'] b1 b2

A、s=selector.xpath("/book/@id")

B、s=selector.xpath("//book/@id")

C、s=selector.xpath("//book/id")

D、s=selector.xpath("/book/id")

点击查看答案

第2题

from scrapy.selector import Selector htmlText=''' ...

from scrapy.selector import Selector htmlText=''' <bookstore> <book id="b1"> <title lang="english">Harry Potter</title> <price> 29.99 </price> </book> <book id="b2"> <title lang="chinese">学习XML</title> <price> 39.95 </price> </book> </bookstore> ''' selector=Selector(text=htmlText) s=selector.xpath("//book/price") print(type(s),s) ____________________________________ print(type(s),s) s=selector.xpath("//book/price").extract_first() print(type(s),s) 程序结果: <class 'scrapy.selector.unified.selectorlist'> [ <selector xpath="//book/price" data="&lt;price&gt;29.99&lt;/price&gt;"> , <selector xpath="//book/price" data="&lt;price&gt;39.95&lt;/price&gt;"> ] <class 'list'> [' <price> 29.99 </price>', ' <price> 39.95 </price>'] <class 'str'> <price> 29.99 </price>

A、s=selector.xpath("/book/price").extract()

B、s=selector.xpath("/book//price").extract()

C、s=selector.xpath("//book//price").extract()

D、s=selector.xpath("//book/price").extract()

点击查看答案

第3题

from scrapy.selector import Selector htmlText=''' ...

from scrapy.selector import Selector htmlText=''' <bookstore> <book id="b1"> <title lang="english">HarryPotter</title> <price> 29.99 </price> </book> </bookstore> ''' selector=Selector(text=htmlText) _________________________ print(s) print(s.extract()) for e in s: print(e.extract()) 程序结果: [ <selector xpath="//book/title/text()" data="arry "> , <selector xpath="//book/title/text()" data="otter"> ] ['arry ', 'otter'] arry otter

A、s=selector.xpath("//book/title/text()")

B、s=selector.xpath("/book/title/text()")

C、s=selector.xpath("//book/title/text")

D、s=selector.xpath("/book/title/text")

点击查看答案

第4题

from scrapy.selector import Selector htmlText=''' ...

from scrapy.selector import Selector htmlText=''' <bookstore> <book id="b1"> <title lang="english">Harry Potter</title> <price> 29.99 </price> </book> <book id="b2"> <title lang="chinese">学习XML</title> <price> 39.95 </price> </book> </bookstore> ''' selector=Selector(text=htmlText) ____________________________________ print(s.extract_first()) ____________________________________ print(s.extract_first()) 程序结果: <title lang="english">Harry Potter</title> <title lang="chinese">学习XML</title>

A、s=selector.xpath("//book[position=1]/title"); s=selector.xpath("//book[position=2]/title")

B、s=selector.xpath("//book[position()=2]/title"); s=selector.xpath("//book[position()=1]/title")

C、s=selector.xpath("//book[position=2]/title"); s=selector.xpath("//book[position=1]/title")

D、s=selector.xpath("//book[position()=1]/title"); s=selector.xpath("//book[position()=2]/title")

点击查看答案

第5题

from scrapy.selector import Selector htmlText=''' ...

from scrapy.selector import Selector htmlText=''' <bookstore> <book> <title lang="english">Harry Potter</title> <price> 29.99 </price> </book> <book id="b2"> <title lang="chinese">学习XML</title> <price> 39.95 </price> </book> </bookstore> ''' selector=Selector(text=htmlText) ______________________________________________ print(s.extract()) 程序结果: [' <book id="b2"> \n <title lang="chinese">学习XML</title>\n <price> 39.95 </price>\n </book>']

A、s=selector.xpath("//title[@lang='chinese']/parent:*")

B、s=selector.xpath("//title[lang='chinese']/parent::*")

C、s=selector.xpath("//title[@lang='chinese']/parent::*")

D、s=selector.xpath("//title[lang='chinese']/parent:*")

点击查看答案

第6题

from bs4 import BeautifulSoup doc=''' <title>The Dormouse's story</title>

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"})

点击查看答案

第7题

selector.xpath("//bookstore/book") 搜索 <bookstore> 下一级的 <book> 元素,找到2个;
点击查看答案

第8题

A.Return his literature books to the bookstore.

B.Keep his books from the literature class.

C.Sell his literature books to the woman.

D.Visit the reference section of the library.

点击查看答案

第9题

A.Bookstores are keeping their promises.

B.Diet books are not always effective.

C.Diet books are usually helpful.

D.There are lots of ways of losing weight.

点击查看答案

第10题

BookStore数据库中有图书表Book(BookCode, BookName, Author, PublisherCode, PublishTime,BookSort, ISBN, BookPicture, ContentInro, Price, Discount),其中 PublishTime是datetime类型。

查询Book表中的图书类别(BookSort),要求每个类别只显示一次。SQL语句:

SELECT _________ BookSort FROM Book

:A、DISTINCT

B、ONLY

C、ONE

D、PERCENT

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信