Wu Yuxiong - born natural python learning Notes: Case: use regular expressions to find mail account

Grab Wan-shui Bookstore "ht A: //www.w sbookshow.com/" All E-mai l account site.
import requests,re

regex = re.compile ( ' [a-zA-Z0-9 _. + -] + @ [a-zA-Z0-9 -] + \. [a-zA-Z0-9 -.] + ' )
url = 'http://www.wsbookshow.com/'
html = requests.get(url)
emails = regex.findall(html.text)
for email in emails:
    print(email)

 

 

Program Description
Import request packet and re package. re package is the regular expression Cregex), by
re. Creating a regular expression object regex compile method.
Crawl "http:. / River wsbookshow.com WW / " site's source code.
Find all the html.text in E -mail account and then displayed.

 

Guess you like

Origin www.cnblogs.com/tszr/p/12020759.html