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

Function get_matched_parts

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

Source from the content-addressed store, hash-verified

44
45# 从页面中提取需要的部分(通常是链接也可以通过正则表达式进行指定)
46def get_matched_parts(page_html, pattern_str, pattern_ignore_case=re.I):
47 pattern_regex = re.compile(pattern_str, pattern_ignore_case)
48 return pattern_regex.findall(page_html) if page_html else []
49
50
51# 开始执行爬虫程序

Callers 1

start_crawlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected