首页 > 其他 > 详细

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

时间:2018-11-24 19:22:25      阅读:763      评论:0      收藏:0      [点我收藏+]

本文使用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最简单实用的解决办法

原文:https://www.cnblogs.com/sgh1023/p/10013071.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!