I have multi-lines of Emails and I need to do a couple of things:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
... etc
- I need to put them in one list:
['[email protected]','[email protected]','[email protected]'
..etc]
need to figure out which Email is the most repetitive within that list, That's how I startred my code and I hope I could complete it from where I ended my code!
fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" fh = open(fname) lines = [] count = 0 # For next step for line in fh: line = line.rstrip() if not line.startswith("From ") : continue x = line.split() emails = x[1] #print y maxapperence = 0 famous = None for mail in emails: count = emails.count(mail) if count > maxapperence: famous = mail print famous apparence = dict() for mail in set(emails): apparence[mail] = emails.count(mail) print apparence]
out put :
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]