Knowingly or unknowingly you have used spaces instead of tabs, or the tabs are inconsistent in your python code. To solve this problem you should first make it apparent what is culprit and where is the culprit.
Sublime Text 3
Make all whitespace characters visible, in Sublime text you should edit Preferences > Settings > User Settings
In your User Settings file add this config. Also if this is the last line in the config don’t end with a comma.
After applying the settings you can easily see it as shown below.
VS Code 1.6.0 and Greater
As mentioned by aloisdg below,
editor.renderWhitespace is now an enum taking either
all. To view all whitespaces:
Before VS Code 1.6.0
Before 1.6.0, you had to set
You can open the file and give ESC : set list
Except spaces, every other whitespace characters will be clearly visible as shown below.