Python matches the corresponding mailbox from the text

Source: Internet
Author: User
#!coding=utf-8import reimport sysdef Compile_mail (file_path): #匹配想要的邮箱, removing unwanted content address = Re.compile (?! [\w\d.+]  [Email protected]) #去除不想要的邮箱 [\w\d.+]+ #匹配前缀 @ ([\w\d.] +\.) + #匹配域名 com #匹配结尾 ", Re. UNICODE | Re. VERBOSE) with open (R ' C:\333.txt ") as Fd:for x in Fd:match = Address.search (x) if Match:print match.group () if __name__ = = ' __ Main__ ': File_path = Sys.argv[1]compile_mail (File_path)


This article is from the "brotherxing" blog, make sure to keep this source http://brotherxing.blog.51cto.com/3994225/1582195

Python matches the corresponding mailbox from the text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.