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