Hello, and welcome!
Please always post the FULL traceback. Python gives you lots of
information to debug problems, so you don't have to guess, but when you
throw that information away, we have to guess.
My guess follows below:
On Fri, Oct 28, 2016 at 09:42:35PM -0700, SONU KUMAR wrote:
>
Please always post the full error text in future.
Meanwhile I'll guess:
On 29/10/16 05:42, SONU KUMAR wrote:
> fname = raw_input("Enter file name: ")
> if len(fname) < 1 : fname = "mbox-short.txt"
> fh = open(fname)
> count = 0
> for line in fh:
>line=line.rstrip
missing parens means you
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
fh = open(fname)
count = 0
for line in fh:
line=line.rstrip
if not line.startswith("From"):continue
lst=line.split()
print lst[1]
count=count+1
print "There were", count, "lines in the file with