【发布时间】:2020-06-07 21:05:02
【问题描述】:
例如:来自 stephen.marquard@uct.ac.za 2008 年 1 月 5 日星期六 09:14:16。
我想从文本文件中提取这一行:mbox-short.txt
下面的示例代码仅提取:来自 stephen.marquard@uct.ac.za 而不是 TIME 的整行
代码:
fh = open(fname)
di = dict()
for email in fh :
if not email.startswith ('From:'): continue
print(email)
【问题讨论】:
-
可以添加文件mbox-short.txt的内容吗?
-
看来你的内容不只是在线,因为你什么都没做删除东西
标签: python