Python中常出现TabError: inconsistent use of tabs and spaces in indentation错误解决方法

问题:

TabError: inconsistent use of tabs and spaces in indentation  

这个错误目前在Sublime3、notepad遇到的都是看似空格实则没有空格引起的

Python用4个空格代表缩进,在使用以上编辑器是要先设置

解决方法:

就是打开sublime的空格制表显示就可以清楚的显示出自己是否真的空格了。

Python中常出现TabError: inconsistent use of tabs and spaces in indentation错误解决方法_第1张图片

红色框住的横线是tab,一个点是一个空格

Sublime3显示空格制表符的设置方法:  

①.Preferences ->  Setting  

②在Preferences->Settings-User中添加以下代码:(如下图)

 "draw_white_space": "all",

Python中常出现TabError: inconsistent use of tabs and spaces in indentation错误解决方法_第2张图片

Python中常出现TabError: inconsistent use of tabs and spaces in indentation错误解决方法_第3张图片

你可能感兴趣的:(Python)