Python学习(二)-常见问题(3)IndentationError: unindent does not match any outer indentation level

 

以下代码最后一行语句缩进数的空格数不一致,会导致运行错误:

 

cat b.py 
#!/usr/bin/python
if True:
    print ("Answer")
    print ("Ture")
else:
    print ("Answer")
   print ("False")     ##缩进不一致会导致致命错误

执行结果:

 

./b.py 
  File "./b.py", line 8
    print ("False")     ##缩进不一致会导致致命错误
                  ^
IndentationError: unindent does not match any outer indentation level

 

 

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐