python问题:IndentationError:expected an indented block错误解决
来源:互联网 发布:ip网络音柱 编辑:程序博客网 时间:2024/05/29 19:54
原文地址:http://hi.baidu.com/delinx/item/1789d38eafd358d05e0ec1df
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的python程序员,也可能陷入陷阱当中。最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分别的。
在编译时会出现这样的错IndentationError:expected an indented block说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行。
往往有的人会疑问:我根本就没缩进怎么还是错,不对,该缩进的地方就要缩进,不缩进反而会出错,,比如:
if xxxxxx:
(空格)xxxxx
或者
def xxxxxx:
(空格)xxxxx
还有
for xxxxxx:
(空格)xxxxx
一句话 有冒号的下一行往往要缩进,该缩进就缩进
阅读全文
0 0
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- python问题:IndentationError:expected an indented block错误解决
- web.xml 配置-servlet
- hdu 6138 Fleet of the Eternal Throne 基于kmp算法的求解
- 广工oj 1231 && 51nod 1821 加强版 思维+并查集 OR 栈
- python随机产生100000个数计算满足条件的比例
- 迭代器
- python问题:IndentationError:expected an indented block错误解决
- java实现多线程延迟加载的单例模式
- WebRTC之本地音频采集(四)
- 重写动画 工具
- 相对传统桌面设计器,在线报表设计器价值何在?
- org.apache.jasper.JasperException: /main.jsp (line: 82, column: 50) equal symbol expected
- POJ 1325 Machine Schedule(最小覆盖数
- ccf认证地铁修建80分运行超时
- 欢迎使用CSDN-markdown编辑器