IndentationError: expected an indented block错误
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的python程序员,也可能陷入陷阱当中。最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分别的。
在编译时会出现这样的错IndentationError:expected an indented block说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行。
往往有的人会疑问:我根本就没缩进怎么还是错,不对,该缩进的地方就要缩进,不缩进反而会出错,,比如:
if xxxxxx:
(空格)xxxxx
或者
def xxxxxx:
(空格)xxxxx
还有
for xxxxxx:
(空格)xxxxx
一句话 有冒号的下一行往往要缩进,该缩进就缩进
原文地址:http://hi.baidu.com/delinx/item/1789d38eafd358d05e0ec1df
IndentationError: expected an indented block错误的更多相关文章
- python问题:IndentationError:expected an indented block错误解决《转》
python问题:IndentationError:expected an indented block错误解决 标签: python语言 2012-07-07 17:59 125145人阅读 评论( ...
- [转]python问题:IndentationError:expected an indented block错误解决
分类: python学习笔记2012-07-07 17:59 28433人阅读 评论(4) 收藏 举报 python语言 原文地址:http://hi.baidu.com/delinx/item/17 ...
- python问题:IndentationError:expected an indented block错误解决
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- IndentationError:expected an indented block错误解决
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- python中IndentationError: expected an indented block错误的解决方法
IndentationError: expected an indented block 翻译为IndentationError:预期的缩进块 解决方法:有冒号的下一行要缩进,该缩进就缩进
- IndentationError : expected an indented block
IndentationError:在python的条件语句出现 expected an indented block问题 是指缩进问题,比如for循环里面的print前面需要四个空格. Python语 ...
- Python问题1:IndentationError:expected an indented block
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- python问题:IndentationError:expected an indented block
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- python 中出现 “IndentationError: expected an indented block” 问题
python 学习 在定义Python函数的时候如下 >>>def hello() . . .print "hello" 这样会报错的,报错如下: Indenta ...
随机推荐
- IE6/IE7尿性笔记 && avalon && director
表单提交 [ie6] form默认特性(input回车以及点击type=submit的按钮会自动触发form submit),在ie6中,不能使button[submit],必须是input[subm ...
- tomcat mysql 练习
[root@k8s-master tomcat_demo]# cat mysql-rc.yml apiVersion: v1 kind: ReplicationController metadata: ...
- Appium测试过程中,建议使用谷歌输入法。用搜狗输入法报错报找不到元素,卡住
1. 手机使用谷歌输入法,在登录页面输入密码时输入数字时卡住报错 代码: 手机卡住 页面:看到页面上没有显示数字,所以卡住报错
- springboot整合TinyMCE文件上传回显
今天想尝试TinyMCE富文本,准备着手搭建自己的博客,发现springboot上传文件,如果把文件放在static文件夹不能即时回显,百度了下,说是要刷新文件夹才能解决. 有问题就有解决办法 方法1 ...
- 小程序开发之wepy框架
ps 本教程使用wepy 1.7+以上的版本 wepy-让小程序支持组件化开发的框架 鹅厂出品,用于开发自家产品的框架还是很良心的,框架设计思路上参照vue,但不是全部照搬,这点要注意. 对微信小程序 ...
- P1736 创意吃鱼法 /// DP
题目大意: https://www.luogu.org/problemnew/show/P1736 题解 dplr[][] 当前点左边(副对角线时为右边)有多少个连续的0 dpup[][] 当前点上边 ...
- HttpServletRequest的方法详细说明
1.Java 部分request.getHeader()详细说明 == JAVA 部分request.getHeader() 详细说明== System.out.println("rotoc ...
- PropertyPlaceholderConfigurer的注意事项
1.基本的使用方法是<bean id="propertyConfigurerForWZ" class="org.springframework.beans.fact ...
- java 上传MultipartFile和String post请求
/** * POST Multipart Request * @Description: * @param requestUrl 请求url * @param requestText 请求参数 * @ ...
- MATLAB 去掉数组里面不要的元素
trainfinger=1 testingfinger=(1:8); testingfinger = testingfinger(~ismember(testingfinger,trainfinger ...