Sep 21, 2020

[Python] Error: inconsistent use of tabs and spaces in indentation

Consistent indentation is critical in Python.
Not using tab is a way to not create the issue.

When an error of "inconsistent use of tabs and spaces in indentation" appears, in most cases it can be solved by setting "tab replaced by space" option in our code editor.

If the issue still exists, we can easily resolve the issue by using a good Python built-in script called "autopep8".
In your command window, just type like: (assumming that the Python scripts PATH has been registered)
    autopep8  -i  file_name_of_our_code.py


No comments:

Post a Comment