Indentationerror:unindent does not match any outer indentation level appears in Python
Copy a piece of code today on-line. The code is very easy and each line looks indented. An error such as the following occurred when executing:
"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 seems to be no problem, there are indentation. And there's no mistake in grammar.
2. Careful study of the code, found that really do not see what the problem. It occurred to me that all the characters of the current Python script (including spaces and tab characters) were displayed to see if there were any indents or other special characters.
The currently used text editor notepad++, has a setting that can display all the characters.
In:
View –> display symbols –> display spaces and tabs
This will allow us to see whether any of our Python code is indented.
Finally found that the reason for the code error is really here, the wrong hint of this line appears to be indented. Indeed, there is no indentation, and that is the root of the problem.
Found a problem. There is no indentation in the Python code that was found in copy, and when we copy someone else's code, the indentation 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 error in Python