From source
Python forces indentation, using the TAB key and spaces, but not mixed. Mixing tabs and spaces results in an error: Indentationerror:unindent does not match any outer indentation level. If your editor doesn't visualize spaces and tabs, it's crazy to change.
PEP8 recommends using spaces to indent. Because different editors, the IDE handles the TAB key differently, some widths are 4, and some are 8.
Configure the following to modify the configuration of visual Studio code and sublime Text3 to visualize spaces and tab keys, and to have 4 spaces instead of 1 tab when you enter the TAB key.
Visual Studio codefile->preferences->user Settings Right window, JSON code:
{ "editor.tabSize": 4,
"Editor.insertspaces":true,
"editor.renderWhitespace": true,
"draw_white_space": "all"}
Sublime text3preferences->settings User, add two entries to the JSON configuration file
" translate_tabs_to_spaces " : Span class= "pun" style= "Color:rgb (147,161,161)",
" Draw_white_space " : "all"
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Python editor settings (including visual Studio code and sublime Text3)