在執行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
一樣的就不會報錯了