Hi Mark, I’m still confused because line 4 reads: fh=open(fname,'r') # Open a new file handle, not fn = open(fname)
Therefore, can you write down line by line from error to correction? Here is the revised code: fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" # assign fname fh=open(fname,'r') # Open a new file handle for line in fh: print line if 'From' in line.split()[0] and '@' in line: sender = line.split()[2] print sender Regards, Hal Sent from Surface _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor