SyntaxError: inconsistent dedent

错误原因:

  一般是拷贝别人的代码过来编辑,由于编辑器不同,出现 tab和 space 的差别。

解决方法:

  Window->Preferences->PyDev->Editor->Tabs

  一般eclipse中会默认把 Replace tabs with spaces when typing 勾上。

  如果出现SyntaxError: inconsistent dedent这个错误,就把这个选项去掉试试。

  

  其他的编辑器,同样的原理。

原文地址:https://www.cnblogs.com/SZxiaochun/p/6867271.html