| Tom Plagge on Wed, 1 Dec 2004 23:17:18 -0600 (CST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| [nimh-dev] scan is easy too |
#!/usr/bin/env python
import email, os, string
pth = "/home/tplagge/Mail/inbox"
def parse_from(msg):
return email.Utils.parseaddr(msg['From'])[0]
def parse_date(msg):
date = email.Utils.parsedate(msg['Date'])
return string.zfill(str(date[1]),2) + "/" + string.zfill(str(date[2]),2)
for file in os.listdir(pth):
f = open(pth + "/" + file, 'r')
if not file.startswith(",") and not file.startswith("."):
msg = email.message_from_file(f)
print file.rjust(5) + parse_date(msg).rjust(7) + " " + \
parse_from(msg)[0:17].ljust(19) + msg['Subject'][0:40]
________________________________________________________________________
Tom Plagge UC Berkeley Physics Dept.
351 LeConte Hall Voice: (510) 643-1650
Berkeley, CA 94720 Email: tplagge@xxxxxxxxxxxxxxxxx
________________________________________________________________________
_______________________________________________
nimh-dev mailing list
nimh-dev@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/nimh-dev