This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handle = """From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 | |
From louis@media.berkeley.edu Fri Jan 4 18:10:48 2008 | |
""".split("\n") # snippet file data: Source-Metadata.txt | |
count = dict() | |
fname = raw_input("Enter file name: ")# insert # to add snippet file data | |
handle = open (fname, 'r')# insert # to add snippet file data | |
for line in handle: | |
if line.startswith("From "): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handle = """From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 | |
From louis@media.berkeley.edu Fri Jan 4 18:10:48 2008 | |
""".split("\n") # snippet file data: mbox-short.txt | |
count = dict() | |
fname = raw_input("Enter file name: ")# insert # to add snippet file data | |
handle = open (fname, 'r')# insert # to add snippet file data | |
for line in handle: | |
if line.startswith("From "): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handle = """From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 | |
From louis@media.berkeley.edu Fri Jan 4 18:10:48 2008 | |
""".split("\n") # snippet file data: mbox-short.txt | |
count = dict() | |
#fname = raw_input("Enter file name: ")# insert # to add snippet file data | |
#handle = open (fname, 'r')# insert # to add snippet file data | |
for line in handle: | |
if line.startswith("From "): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handle = """From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008 | |
Return-Path: <postmaster@collab.sakaiproject.org> | |
Received: from murder (mail.umich.edu [141.211.14.90]) | |
by frankenstein.mail.umich.edu (Cyrus v2.3.8) with LMTPA; | |
Sat, 05 Jan 2008 09:14:16 -0500 | |
X-Sieve: CMU Sieve 2.3 | |
Received: from murder ([unix socket]) | |
by mail.umich.edu (Cyrus v2.2.12) with LMTPA; | |
Sat, 05 Jan 2008 09:14:16 -0500 | |
Received: from holes.mr.itd.umich.edu (holes.mr.itd.umich.edu [141.211.14.79]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handle = """From: stephen.marquard@uct.ac.za | |
X-DSPAM-Probability: 0.0000 | |
Author: stephen.marquard@uct.ac.za | |
From: louis@media.berkeley.edu | |
Return-Path: <postmaster@collab.sakaiproject.org> | |
From: stephen.marquard@uct.ac.za | |
Received: from 141.211.14.97 | |
From: zqian@umich.edu""".split("\n") | |
# Ok - we have fake data - let's process it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count = dict() | |
for line in handle: | |
if line.startswith("From "): | |
address = line.split()[1] | |
count[address] = count.get(address, 0) + 1 | |
maxval = None | |
maxkee = None | |
for kee, val in count.items(): |