Hi Everyone:





I have a second and unrelated question:





I tried to work backward  to see if there is a logic error associated with a 
variable is being skipped over:




#top of code, initialize variable
output_list = ["default"]




#rest of code
If you get at the end





print output_list





['default']





Raw Data File:




count = 0
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
for line in fname:
    line = line.strip()
    if not line.startswith('From '): continue
    line = line.split()
count = count + 1
print len(line)
fh = open(fname)
print "There were", count, "lines in the file with From as the first word"





Sample data file at  http://www.pythonlearn.com/code/mbox-short.txt





Desired Output:




[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]





Thanks,

Hal


Sent from Surface





From: Phu Sam
Sent: ‎Wednesday‎, ‎July‎ ‎29‎, ‎2015 ‎1‎:‎06‎ ‎PM
To: Ltc Hotspot





































_______________________________________________
Baypiggies mailing list
[email protected]
To change your subscription options or unsubscribe:
https://mail.python.org/mailman/listinfo/baypiggies
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to