Question: here is my professor answer key but is not work python code: fileName = input(Enter file name and path: ) fhand = open(fileName) ct =0
here is my professor answer key but is not work
python code:
fileName = input("Enter file name and path: ")
fhand = open(fileName)
ct =0
for line in fhand:
line = line.strip()
if line.startswith('From:'):
s, email=line.split()
print(email)
ct += 1
print ("There were" , ct , "lines in the file with From as the first word.")
Error message is
Traceback (most recent call last): File "J:/python/sg2/From.py", line 7, in
my lord file is txt message
From: stephen.marquard@uct.ac.za Sat-Jan-5-09:14:16-2008 Message line 1 Message line 2 Message line N From: k.jorden@uci.edu Tue-Dec-12-15:10:11-2011 Message line 1 From: joe@mail.com Mon-Feb-8-10:22:00-2009
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
