python TabError: Inconsistent use of tabs and spaces in indentation

来源:互联网 发布:paxos算法为代码 编辑:程序博客网 时间:2024/06/05 19:19




错误原因,在所写的函数中用了空格,python应该要用tab来进行缩进的。


这个错误是说你用了tab键作缩进了,


因为在Python不像C/C++里用大括号来区分程序块,而是用缩进


所以缩进很重要你把
空格都换成Tab就好了  



附函数调用
#python 函数def test(a):if a >0:return aelse:return 0print(test(5))print(test(-5))



阅读全文
0 0
原创粉丝点击