解决TabError: inconsistent use of tabs and spaces in indentation


When using an open source library ruptures on Github for mutation point detection, when calling its display method to visualize the detection results, I feel that the effect is general, as shown below:


Find the source code analysis of display and transform its matplotlib drawing part:


Improve line color for drawing line charts, font Times New Romanand scale.

After saving, when executing the Python script, I encountered: TabError: inconsistent use of tabs and spaces in indentation, which means 不要混合使用 4 个空格和 tab 键.

the solution:

  • Settings in Sublime Text: Preferences -> Settings, set display tabs: "draw_white_space": "all"
  • And set the tab key to automatically convert to four spaces, as follows:
"tab_size": 4,
"translate_tabs_to_spaces": true,
"expand_tabs_on_save": true

Then restart jupyter notebook and then execute the code without error.


Blog Garden | Solve TabError: inconsistent use of tabs and spaces in indentation

Guess you like

Origin blog.csdn.net/fyfugoyfa/article/details/123755242