抓取页面上的email邮箱

#!/usr/bin/python
#-*- coding:utf-8 -*-
import requests  
import re  

def get_email(url):  
    """get all the email address from the url"""  
    content = requests.get(url).text  
    pattern = r'[0-9a-zA-Z._]+@[0-9a-zA-Z._]+.[0-9a-zA-Z._]+'  
    p = re.compile(pattern)  
    m = p.findall(content)  
    with open('emil.txt', 'a') as f:  
        for mm in m:  
            f.write(mm+'
')  
    ''''' 
    with open('tmp.html', 'w') as f: 
        f.writelines(content) 
    '''  
if __name__=='__main__':  
    get_email('https://www.aliyun.com/jiaocheng/442063.html')  
原文地址:https://www.cnblogs.com/husbandmen/p/9029331.html