Python is relied on indentation, and if you edit python code in Vim, you may found it will mess up your indentation. Here is a simple way to fix it.
Open your file in Vim you will see something like this:
and enter Vim command
to see all white spaces. If you see something like this:
You know you have inconsistent indentation. “^I” means tab, but “print c” statement is indented by space.
How to fix this? Easy.
Edit your .vimrc file to have following:
For the files having indentation issue, run Vim command to fix them:
Now check the file again using “:set list”, and you will see all tabs are gone. They are places by spaces.