【问题标题】:Extract email id from text file by showing path通过显示路径从文本文件中提取电子邮件 ID
【发布时间】:2015-12-16 09:56:39
【问题描述】:

我的文本文件保存在我的桌面上,其中包含我的简历我想从文本文件中提取我的电子邮件有人可以帮助我吗 我的txt文件有

Name                        :      K. Spandana

Gender                      :      Female

Nationality                 :      Indian

Marital Status              :      Unmarried
Mother tongue               :      Telugu
Languages Known             :      English, Hindi and Telugu
Address of Correspondence   :      H.NO:4-56/1, Hanuman nagar ,Post: Theegalaguttapalli,

E-mail ID                   :      Spandanareddy.kallepu@gmail.com

我试过了 https://gist.github.com/dideler/5219706 带文件路径的代码

【问题讨论】:

  • 您能告诉我们您尝试过什么吗?如果有的话,您遇到的具体问题是什么?

标签: python machine-learning nlp text-extraction


【解决方案1】:

以下内容将起作用:

with open('resume.txt', 'r') as f_input:
    print re.findall(r'\b([a-z0-9-_.]+?@[a-z0-9-_.]+)\b', f_input.read(), re.I)

它将显示:

['Spandanareddy.kallepu@gmail.com']

但确切的逻辑可以是far more complicated。这完全取决于它需要有多准确。

这将显示文本文件中的所有电子邮件地址,以防万一。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-23
    • 2011-05-15
    • 2020-06-06
    • 2018-03-13
    • 2018-07-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多