IndentationError:expected an indented block错误解决
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中。最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分别的。
在编译时会出现这样的错IndentationError:expected an indented block说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行。
往往有的人会疑问:我根本就没缩进怎么还是错,不对,该缩进的地方就要缩进,不缩进反而会出错,,比如:
if xxxxxx:
(空格)xxxxx
或者
def xxxxxx:
(空格)xxxxx
还有
for xxxxxx:
(空格)xxxxx
一句话 有冒号的下一行往往要缩进,该缩进就缩进
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和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- python中IndentationError: expected an indented block错误的解决方法
IndentationError: expected an indented block 翻译为IndentationError:预期的缩进块 解决方法:有冒号的下一行要缩进,该缩进就缩进
- IndentationError: expected an indented block错误
Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的python程序员,也可能陷入陷阱当中.最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分 ...
- 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 ...
随机推荐
- Django 编写模板并渲染的示例
>>> from django.template import Template, Context >>> raw_template = ""& ...
- minitab笔记
1.如何用minitab检测一组数据是否服从正态分布 打开Minitab之后点击Stat>Basic Statistics> Normality Test,分析之后若 P value(P值 ...
- vs2010下使用sqlite
1.SQLite安装SQlite官网:http://www.sqlite.org/download.html 找到以下截图中内容 第一个解压之后是sqlite3.exe,第二个解压之后是sqlite3 ...
- npm下设置NODE_ENV下mac与windows的差异
linux & mac: export NODE_ENV=production windows:set NODE_ENV=production windows: mac:
- 美国FLAG和中国BAT的比较(王益)
美国FLAG和中国BAT的比较(王益) http://cxwangyi.github.io/notes/2014-09-29-flag-vs-bat.html 知乎 http://www.zhihu. ...
- 页面检测网络外网连接- 网页基础模块(JavaScript)
方法一 html 添加图片标签 加载外站图片 <img id="connect-test" style="display:none;" onload=&q ...
- element-ui <el-input> 注册blur事件
<template> <div class="demo"> <el-input placeholder="注册blur事件" v- ...
- Saiku登录源码追踪.(十三)
Saiku登录源码追踪呀~ >>首先我们需要debug跟踪saiku登录执行的源码信息 saiku源码的debug方式上一篇博客已有说明,这里简单介绍一下 在saiku启动脚本中添加如下命 ...
- sql将服务器名称换成本地IP
安装sql后服务器名称默认为电脑的名称,而想要换成习惯用的本地ip也是可以的. 将配置管理中的MSSQLSEVER协议中的TCP/IP启用,并且打开其属性,找到IP地址,添加本地IP,并设置成启用,然 ...
- java语言编写矩阵的四则运算
题目要求如下: 设计程序实现矩阵的四则运算 设计要求: (1) 实现矩阵的四则运算. (2) 考虑实现带变元的矩阵计算. (3)考虑实现矩阵的特征值和特征向量的计算. 我使用java语言写的 目录结构 ...