Skip to content

Instantly share code, notes, and snippets.

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 "):
@ltc-hotspot
ltc-hotspot / assignment
Last active August 29, 2015 14:27
assignment_10_2
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 "):
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 "):
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])
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
@ltc-hotspot
ltc-hotspot / assignment_9_2
Last active August 29, 2015 14:26
assignment
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():