Run your program with
python -t script.py
This will warn you if you have mixed tabs and spaces.
On *nix systems, you can see where the tabs are by running
cat -A script.py
and you can automatically convert tabs to 4 spaces with the command
expand -t 4 script.py > fixed_script.py
PS. Be sure to use a programming editor (e.g. emacs, vim), not a word processor, when programming. You won't get this problem with a programming editor.
PPS. For emacs users, M-x whitespace-mode
will show the same info as cat -A
from within an emacs buffer!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…