IndentationError: unindent does not match any outer indentation level报错的解决

执行一个Python脚本的时候,报IndentationError: unindent does not match any outer indentation level" 错误,搜索了一下相关资料,遇到这个错误,是因为新的Python语法中是不支持的代码对齐中,混用TAB和空格的。

 

如上所示,可以使用Notepad++打开脚本,勾选显示空格与制表符,此时你会看到代码对齐使用了制表符与空格。

 

解决方法:

 

1: 使用工具pycharm  有个快捷键 CTRL+ALT+L格式化代码。

 

 

参考资料:

https://www.cnblogs.com/kerrycode/p/11183963.html

 

posted @ 2020-12-15 14:22  Marlon康  阅读(3722)  评论(0编辑  收藏  举报