Created
August 23, 2016 04:49
-
-
Save meetupwayne/3ec2d062fed24ae2896665efe9dd83d9 to your computer and use it in GitHub Desktop.
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
fname = raw_input("Enter file name: ") | |
if len(fname) < 1 : fname = "mbox-short.txt" | |
fh = open(fname) | |
count = 0 | |
for line in fh: | |
if line.startswith('From') and not line.startswith('From:'): | |
print line.split()[1] | |
count+= 1 | |
print "There were", count, "lines in the file with From as the first word" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment