Python Forum
unindent does not match any outer indentation level - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: unindent does not match any outer indentation level (/thread-9025.html)



unindent does not match any outer indentation level - tonyk334 - Mar-18-2018

Hi

Please help

Thank you

iam getting
unindent does not match any outer indentation level

this is my code
for fname in os.listdir("."): 
    if "ETV" in fname:
        with open(fname) as csvfile:
             spamreader = csv.reader(csvfile, delimiter='/')
             for row in spamreader:  # for loop
                #print row[7]
                if row[2].startswith("PIN") and row[7] == 'E':
                    reg_pin_e += 1
                    reg_pin_page_e += int(row[9])
                if row[2].startswith("PIN") and row[7] == 'B':
                    reg_pin_b += 1
                    reg_pin_page_b += int(row[9])
                if row[2].startswith("PIN") and row[7] == 'W':
                    reg_pin_w += 1
                    reg_pin_page_w += int(row[9])
                if row[2].startswith("PIN") and row[7] == 'N':
                    reg_pin_n += 1
                    reg_pin_page_n += int(row[9]) 
 [b]print("Total Pin-E Count  --> "  +  str(reg_pin_e))[/b]
 print("total Pin-E Pages  --> "  +  str(reg_pin_page_e)) 
 print("Total Pin-N Count  --> "  +  str(reg_pin_n))
 print("total Pin-N Pages  --> "  +  str(reg_pin_page_n)) 
 print("Total Pin-W Count  --> "  +  str(reg_pin_w))
 print("total Pin-W Pages  --> "  +  str(reg_pin_page_w)) 
 print("Total Pin-B Count  --> "  +  str(reg_pin_b))
 print("total Pin-B Pages  --> "  +  str(reg_pin_page_b)) 
this is line give me issue

print("Total Pin-E Count  --> "  +  str(reg_pin_e))



RE: unindent does not match any outer indentation level - wavic - Mar-18-2018

I don't see any indentation. Please, put your code between code tags to preserve the indentation in the post!


RE: unindent does not match any outer indentation level - Larz60+ - Mar-18-2018

Just like the error says, the print statements are not properly indented!


RE: unindent does not match any outer indentation level - tonyk334 - Mar-18-2018

Than you All

i found the error it was not with open(fname) as csvfile:

Thank you


RE: unindent does not match any outer indentation level - Larz60+ - Mar-18-2018

Quote:it was not with open(fname) as csvfile
did someone say it was?
your error was clearly indentation