学习目标:
①:提取所有的URL
- Python日常
内容展示:
①:提取所有的URL
import re
s = '<a href="https://geekori.com">极客起源</a> <a href="https://www.microsoft.com">微软</a>'
result = re.findall('<a[^>]*href="([^>]*)">',s,re.I)
print(result)
# ['https://geekori.com', 'https://www.microsoft.com']
总结:
1.分析a节点的正则表达式 ‘<a[>]*href="([>]*)">’
2.利用分组提取href的url
- CSDN Python日常 第【3】12 篇
- 下一篇链接