From maildir\brawner-s\inbox

1 17


In [20]:
import re

In [21]:
with open("17", "r") as f:
    b = f.read()

b = b.replace("\t", "")

b = b.replace("\n", "")

Show how I got this

Also, why using search(). Only match one.


In [37]:
d1 = re.search("To: ([\w@,. \-\'\<\>]*)Subject", b).group(1)

In [23]:
with open("1", "r") as f:
    c = f.read()

c = c.replace("\t", "")

c = c.replace("\n", "")

In [24]:
d2= re.search("To: ([\w@,. \-\'\<\>]*)Subject", c).group(1)

In [25]:
print re.search("From: ([\w@,. \-\'\<\>]*)To", c).group(1)
print re.search("From: ([\w@,. \-\'\<\>]*)To", b).group(1)


liz.taylor@enron.com
david.forster@enron.com

In [38]:
len(d1)


Out[38]:
14485

In [39]:
d1 = d1.split(",")

In [40]:
d1 = [d.replace(" ","") for d in d1]
d1[:6]


Out[40]:
['tom.alonso@enron.com',
 'tim.belden@enron.com',
 'f..calger@enron.com',
 'jill.chatterton@enron.com',
 'sean.crandall@enron.com',
 'debra.davidson@enron.com']

In [ ]: