import sys 報錯,檔名 try.py (建議避免與標準庫同名)。
Python **強制縮進一致性**,混合 Tab (\t) 和空格 會導致 IndentationError 或邏輯錯誤。常見於複製網頁代碼、不同編輯器設置不一致。
python -m tabnanny try.py 自動檢測混合縮進。編碼 → Tab 轉換為空格;或 VS Code Convert Indentation to Spaces。try.py → my_script.py 避免遮蔽標準庫模組。.editorconfig 強制團隊統一風格:
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true