python错误提示“TabError: inconsistent use of tabs and spaces in indentation”

 在遍历打印10以内的奇数是出现“TabError: inconsistent use of tabs and spaces in indentation”的错误提示:

代码如下:

 

第一感觉没什么错误,但是当我设置显示“空格与制表符”时候,问题出现了,在第4、5行前由制表符,如图所示:

在if和continue前有制表符,所以执行的时候会提示“TabError: inconsistent use of tabs and spaces in indentation”

解决问题重新运行,结果OK。

亲测好使。。。

原文地址:https://www.cnblogs.com/zjiacun/p/7111915.html