> What is the source of the syntax error to the String Attribute?
>
> Go to the following URL links and view a copy of the raw data file code
> and sample data:
>
> 1.) http://tinyurl.com/p2xxxhl > 2.) http://tinyurl.com/nclg6pq
If you want help here, reduce your code and input to the minimum needed,
put the input in the code as a string, and if you still do not see the
problem, post here, along with the traceback.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
fname = raw_input("Enter file name: ")
if len(fname) < 1 :
fname = "mbox-short.txt"
for line in fname:
line = line.strip()
if not line.startwith('From '):
continue
line = line.split()
count = count + 1
You need to actually open the file. (Look up how to do that) The first 'for' loop is looping through the file NAME, not the file OBJECT. Also, line.startwith() should be line.startswith().