第四章测试
1.HTML 是整个网页的结构,相当于整个网站的框架。带“<”、“>”符号的都是属于 HTML 的标签,并且标签都是成对出现的。下列说法中,错误的是( )。
A:表示超链接标签 B:<html>..</html> 表示标记中间的元素是网页 C:<img>..</img>表示该标签是标题 D:有的标记附标签是可以带有属性参数,表示为<标记 属性="参数值">
答案:C
2.下列关于BeautifulSoup中对象类型描述错误的是( )。
A:name属性可获取标签名 B:NavigableString属性可获取标签内非属性字符串 C:attrs属性可获取标签的属性 D:string属性可获取标签的id属性
3.执行以下程序输出的结果是( )。
from bs4 import BeautifulSoup
html='<html><p class="story">ss<a id="name1">Alice</a></p><a id="name2">Amy</a></html>'
soup=BeautifulSoup(html,'html.parser')
print(soup.a.string)
A:Alice Amy B:Amy C:Alice D:ss 4.执行以下程序输出的结果是( )。
from bs4 import BeautifulSoup
html='<html><p class="story">ss<a id="name1">Alice</a></p><a id="name2">Amy</a></html>'
soup=BeautifulSoup(html,'html.parser')
soup.find_all(name='a',id='name2')
A:[<a id="name1">Alice</a>, <a id="name2">Amy</a>] B:[<p class="story">ss<a id="name1">Alice</a></p>] C:[<a id="name2">Amy</a>] D:[<a id="name1">Alice</a>] 5.执行以下程序输出的结果是( )。
from bs4 import BeautifulSoup
html='<html><p class="story">ss<a id="name1">Alice</a></p><a id="name2">Amy</a></html>'
soup=BeautifulSoup(html,'html.parser')
soup.select('p~a')
A:[<a id="name2">Amy</a>] B:[<p class="story">ss<a id="name1">Alice</a></p>] C:[<a id="name1">Alice</a>] D:[<a id="name1">Alice</a>, <a id="name2">Amy</a>]

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(126) dxwkbang
返回
顶部