python笔记:运行脚本出现Unident dose not match any outer indentation level错误

之前在Note pad++上写了一个python脚本,后来用pycharm打开时遇到这个错误


错误原因:缩进对齐时空格与TAB键混用了。四个点为四个空格,一个箭头为一个TAB键,新的python语法中,缩进是不支持空格和TAB混用的。

python笔记:运行脚本出现Unident dose not match any outer indentation level错误

解决办法:空格取代TAB键。Note pad++中设置-->首选项-->语言,勾选替换为空格,以后输入TAB键会自动转变为4个空格

python笔记:运行脚本出现Unident dose not match any outer indentation level错误