Reputation: 413
# Use the file name mbox-short.txt as the file name
fname = raw_input("Enter file name: ")
count = 0
avg = 0
fh = open(fname)
for line in fh:
if not line.startswith("X-DSPAM-Confidence:") :
continue
count = count + 1
pos = line.find(":")
new = float(line[pos+1:])
avg = avg + new
print "Done",count,avg
I get the following error for this code:
line 11
IndentationError : unexpected indent
Please help me out. This stuff may seem stupid to some but pardon me, I'm a noob. Thanks in advance
Upvotes: 0
Views: 299
Reputation: 432
Please make sure you are not indenting using Tab
and Space
at the same time.
If you mixing Tab
and Space
when indenting, python will be confused. I good practice is to set your text editor's auto indentation to the same indentation you preferred. This way, in case you need to manually change indentation, your indentation will be consistent with those created by your text editor.
Upvotes: 1