Python运行出现语法错误:IndentationError | TabError: 缩进错误排查

写了python代码,肉眼看没发现缩进错误啊,可是运行报缩进错误以下:html

C:\Users\Administrator\Desktop>c:\Python34\python.exe dict.py
  File "dict.py", line 18
    continue
           ^
TabError: inconsistent use of tabs and spaces in indentation
C:\Users\Administrator\Desktop>

排错方法:由于当前用的文本编辑器Notepad++,能够显示全部的字符的,在: 视图 -> 显示符号 -> 显示空格与制表符,就能够明确看到错误缘由了!python

缘由:新的Python语法,是不支持的代码对齐中,混用TAB和空格的。因此出现上述错误提示了。bash

解决办法:请把TAB改成空格便可!编辑器

参考博文:cnblogs.com/heimanba/p/3783022.htmlide

IndentationError.png

相关文章
相关标签/搜索