Indentationerror:unindent does not match any outer indentation level appears in Python
Today on the online copy of a piece of code, the code is very simple, each line seems to indent the indentation, the operation of the following error occurred:
"Resolution Process"
1. The most common reason for this error is that it does not indent. According to the number of error prompts, go to the code to see, there is no problem, there are indentation, and the syntax is not wrong.
2. Careful study of the code, found that there is really no problem, it occurred to me that all the characters of the current Python script (including spaces and tab characters) are displayed to see if there is any indentation or other special characters.
Currently with the text editor notepad++, there is a setting that can display all the characters.
In:
View –> display symbols –> display spaces and tabs
This allows us to see whether the indentation of our Python code is indented in the end.
Finally found that the code is the reason for the error is here, the wrong hint of the line appears to be indented, and actually do not indent, this is the source of the problem.
Found a problem, found that copy of the Python code is not indented, when we copy someone else's code, indentation this requires extra attention. Don't look like the code is indented and it feels OK, actually it's not indented.
Indentationerror:unindent does not match any outer indentation level appears in Python