MCPcopy Create free account
hub / github.com/ZiniuLu/Python-100-Days / get_matched_parts

Function get_matched_parts

Day66-75/code/example01.py:38–40  ·  view source on GitHub ↗
(page_html, pattern_str, pattern_ignore_case=re.I)

Source from the content-addressed store, hash-verified

36
37# 从页面中提取需要的部分(通常是链接也可以通过正则表达式进行指定)
38def get_matched_parts(page_html, pattern_str, pattern_ignore_case=re.I):
39 pattern_regex = re.compile(pattern_str, pattern_ignore_case)
40 return pattern_regex.findall(page_html) if page_html else []
41
42
43# 开始执行爬虫程序并对指定的数据进行持久化操作

Callers 1

start_crawlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected