1 Star 0 Fork 1

gx/clean-python

forked from tangjinfeng/clean-python 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
small_function.py 541 Bytes
一键复制 编辑 原始数据 按行查看 历史
MarkP88 提交于 2019-04-03 04:31 +08:00 . Initial commit
import re
def get_unique_emails(file_name):
"""
Get all unique emails.
"""
for line in read_file(file_name):
match = re.findall(r'[\w\.-]+@[\w\.-]+', line)
for email in match:
yield email
def read_file(file_name):
"""
Read file and yield each line.
"""
with open(file_name) as fread:
for line in fread:
yield line
def print_email_list():
"""
Print list of emails
"""
for email in get_unique_emails('duplicate_emails'):
print(email)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Simple_r/clean-python.git
git@gitee.com:Simple_r/clean-python.git
Simple_r
clean-python
clean-python
master

搜索帮助