报错TabError: Inconsistent use of tabs and spaces in indentation

TabError: Inconsistent use of tabs and spaces in indentation

报错TabError: Inconsistent use of tabs and spaces in indentation_第1张图片

首先这个错误的意思是:在缩进的时候,使用了错误的空格和tab
报错TabError: Inconsistent use of tabs and spaces in indentation_第2张图片
我使用的python3.6,造成这个错误的原因是我在网上复制代码后,残生了错位或者其他原因,也就是说,这种错误产生的原因正是由于空格或者tab缩进造成的。

然后我做了试验,将空格删除,直接使用tab完成缩进,发现程序正常运行;

再试一下空格缩进,然后发现还是报错了,同样TabError: Inconsistent use of tabs and spaces in indentation。

需要统一输入格式,要不全用tab缩进,要不全用空格,不统一,会报错

你可能感兴趣的:(python,python,bug,linux)