zl程序教程

您现在的位置是:首页 >  其它

当前栏目

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

解决 in and of use inconsistent tabs
2023-09-14 09:00:00 时间

在执行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

 

 一样的就不会报错了