单选题 正则表达式r"^A.∗Z

A、 以A开头、Z结尾的字符串
B、 包含A和Z的字符串
C、 以Z开头、A结尾的字符串
D、 任意字符串
下载APP答题
由4l***2d提供 分享 举报 纠错

相关试题

单选题 re.sub(r' \s+','-',text)的作用是?

A、将多个空格替换为-
B、删除所有空格
C、将-替换为空格
D、匹配所有数字

单选题 正则表达式r"\d+"匹配什么内容?

A、至少一个数字
B、任意字符
C、一个字母
D、空白符

单选题 如何获取<a href="https://example.com">Example</a>的href属性?

A、a_tag['href']
B、a_tag.get('href')
C、a_tag.attrs['href']
D、以上均可

单选题 如何获取某个标签的所有属性(如<a href="..." class="link">)?

A、tag.attrs
B、tag.attributes
C、tag.get_attrs()
D、tag.properties

单选题 如何用re匹配所有邮箱地址(如user@example.com)?

A、re.findall(r'\w+@\w+\.\w+',text)
B、re.search(r'email:\s∗(.+)',text)
C、re.match(r'@.∗',text)
D、re.split(r'@',text)

单选题 如何提取<p class="content">Hello</p>中的文本"Hello"?

A、p_tag.string
B、p_tag.text
C、p_tag.get_text()
D、以上均可

单选题 如何用 BeautifulSoup 查找 所有 class 包含"news"的<div>?

A、soup.find_all('div', class_='news')
B、soup.find_all('div', class_=re.compile('news')
C、soup.select(' div.news')
D、以上全部

单选题 使用 BeautifulSoup解析HTML时,以下哪个方法可以找到第一个<div>标签?

A、soup.find_all('div')[0]
B、soup.div
C、soup.select_one('div')
D、以上全部