您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

PyCharm出现TabError: inconsistent use of tabs and spaces in indentation最简单实用的解决办法

5b51 2022/1/14 8:24:21 python 字数 2116 阅读 661 来源 www.jb51.cc/python

本文使用PyCharm的格式化代码功能解决TabError: inconsistent use of tabs and spaces in indentation。

概述

本文使用PyCharm的格式化代码功能解决TabError: inconsistent use of tabs and spaces in indentation。

当把代码从别处复制进来PyCharm,然后运行报错:TabError: inconsistent use of tabs and spaces in indentation

这个报错的意思是说IDE分不清tab和空格,说明你的代码中混用了tab和空格。

传统的方式是找出代码中报错的地方,然后修改

这种方法可以,但是我试的并不好用。我推荐一种解决方法格式化代码

具体操作是:Code -->Reformat Code

再次尝试运行,问题完美解决

总结

以上是编程之家为你收集整理的PyCharm出现TabError: inconsistent use of tabs and spaces in indentation最简单实用的解决办法全部内容,希望文章能够帮你解决PyCharm出现TabError: inconsistent use of tabs and spaces in indentation最简单实用的解决办法所遇到的程序开发问题。


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶