selenium——实现自动爬取yemi页面中的邮箱

import re
from selenium import webdriver

driver=webdriver.Firefox()
driver.get(“http://home.baidu.com/home/index/contact_us“)
doc=driver.page_source #查看页面的源代码
emails=re.findall(r’[\w]+@[\w.-]+’,doc) #正则表达式匹配邮箱(字符串前加r表示原生字符串,\w表示匹配字母数字及下划线,findall返回的是一个匹配字符串的列表 )

循环打印匹配的邮箱

for email in emails:
print(email)

猜你喜欢

转载自blog.csdn.net/cqupt_zl/article/details/80977482
今日推荐