TabError: inconsistent use of tabs and spaces in indentation

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

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


1、提出问题:


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


20181124183547561.png


2、 分析原因


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


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


3、 解决方案:格式化代码!


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


20181124185103181.png


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


目录
相关文章
|
11月前
|
JavaScript
解决 NavigationDuplicated: Avoided redundant navigation to current location: “/“
解决 NavigationDuplicated: Avoided redundant navigation to current location: “/“
155 0
解决 NavigationDuplicated: Avoided redundant navigation to current location: “/“
|
JavaScript
vue 里 使用 eslint 报错 error:Mixed spaces and tabs (no-mixed-spaces-and-tabs)
vue 里 使用 eslint 报错 error:Mixed spaces and tabs (no-mixed-spaces-and-tabs)
338 0
vue 里 使用 eslint 报错 error:Mixed spaces and tabs (no-mixed-spaces-and-tabs)
inconsistent use of tabs and spaces in indentation
inconsistent use of tabs and spaces in indentation
88 0
inconsistent use of tabs and spaces in indentation
|
数据可视化 Python
解决TabError: inconsistent use of tabs and spaces in indentation
inconsistent use of tabs and spaces in indentation
2300 0
解决TabError: inconsistent use of tabs and spaces in indentation
|
Python
Python 缩进问题-inconsistent use of tabs and spaces in indentation.原因及解决方法
Python 缩进问题-inconsistent use of tabs and spaces in indentation.原因及解决方法
5566 0
Python 缩进问题-inconsistent use of tabs and spaces in indentation.原因及解决方法
get assigned pageset and my pages
get assigned pageset and my pages
80 0
get assigned pageset and my pages