正则表达式
使用Python的`re`模块,你可以编写正则表达式来匹配和提取HTML中的特定文本。
```python
import re
html = "这是一个示例链接"
links = re.findall(r'href="(.*?)"', html)
print(links) 输出: ['https://example.com']
Beautiful Soup
Beautiful Soup是一个Python库,用于从HTML或XML文件中提取数据。
```python
from bs4 import BeautifulSoup
html_str = "