# -*- coding: UTF-8 -*- from selectolax.parser import HTMLParser def get_p(html): p_list = [] for node in HTMLParser(html).css("p"): p_list.append(node.text()) return p_list html = '''
body 元素的内容会显示在浏览器中。
title 元素的内容会显示在浏览器的标题栏中。
''' print(get_p(html))