zoukankan      html  css  js  c++  java
  • 抓取页面上的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')  
    
  • 相关阅读:
    UVa 106
    UVa 111
    UVa 105
    UVa 104
    UVa 103
    UVa 102
    UVa 101
    UVa 100
    就决定是你了!
    阿姆斯特朗回旋加速喷气式阿姆斯特朗炮
  • 原文地址:https://www.cnblogs.com/husbandmen/p/9029331.html
Copyright © 2011-2022 走看看