解决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

 

 一样的就不会报错了


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM