针对解决python中“inconsistent use of tabs and spaces in indentation”的问题

针对解决python中“inconsistent use of tabs and spaces in indentation”的问题

问题出现:在no’tepad++写好的python代码,丢到pycharm中编译时出现:“inconsistent use of tabs and spaces in indentation”的错误,对应的含义为:缩进中的制表符和空格使用不一致【Google翻译的结果】,通俗来说就是,号为2表明想要tab但是并不是tab.
针对解决python中“inconsistent use of tabs and spaces in indentation”的问题
图一

解决思路:采用notepad++ 将所有作者想要tab符号修改为真正的tab符号,如图二所示,该位置为真正的tab符号,但此时变成了空格。
针对解决python中“inconsistent use of tabs and spaces in indentation”的问题
图二
解决方法:根据解决思路中所述,我们采用notepad++去解决此问题。
1.采用notepad++打开问题xx.py文件
2.编辑–> 空白字符操作 --> 空格转TAB(全部)【如图三所示】
3.完成前两步骤之后xx.py文件便会出现图四的结果,同图二形 成对比,此时问题解决。
针对解决python中“inconsistent use of tabs and spaces in indentation”的问题
图三
针对解决python中“inconsistent use of tabs and spaces in indentation”的问题
图四
参考资料链接:
1.https://blog.****.net/godot06/article/details/80974884
2.https://www.cnblogs.com/doublesnow/p/8654882.html

说明:图一和图三来源于参考资料。