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

在执行Python脚本时遇到

  TabError: inconsistent use of tabs and spaces in indentation

原因:

  不要混合使用4个空格和tab键

解决的方法:

  设置sublime,Preferences ->  Setting

  (1)设置显示制表符

添加

"draw_white_space":"all"

查看代码文件

 

 

   (2)设置tab键自动转化为四个空格

"tab_size":4,
// 按下tab时转换
"translate_tabs_to_spaces": true,
//设置保存时自动转换
"expand_tabs_on_save": true

 

 一样的就不会报错了

posted @ 2020-01-20 13:02  慕尘  阅读(13145)  评论(0编辑  收藏  举报