Python:提取網頁中的電子郵箱



import requests, re

#regex = r"([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)"
#這個正則表達式過濾掉了qq郵箱
regex = r"([a-zA-Z0-9_.+-]+@[a-pr-zA-PRZ0-9-]+\.[a-zA-Z0-9-.]+)"
#基於隱私,使用了“XXXXXXXXXXXXXX”
url = 'http://blog.sina.com.cn/s/XXXXXXXXXXXXXXXXXX.html'
html = requests.get(url).text
#print(html)
emails = re.findall(regex,html)
i = 0
for email in emails:
i += 1
if i < 16:
print("{} :{}".format(i,email))


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM