如何编写 Python 正则表达式来获取网页中的所有锚标签?
pythonserver side programmingprogramming更新于 2025/7/9 15:08:17
以下代码提取给定字符串中的所有标签
示例
import re rex = re.compile(r'[\<\>]') l = "this is text1 <a href='irawati.com' target='_blank'>hi</a> this is text2" print rex.findall(l)
输出
['<', '>', '<', '>']
相关文章
有用资源
python 参考教程 - 该教程包含有关 python 的更多信息:https://www.cainiaomax.com/python/

