【python :编译错误】 IndentationError:unexpected indent(缩进问题)
转载:python :脚本运行出现语法错误:IndentationError:unexpected indent(缩进问题)
转载:TRACEING
【问题】
一个python脚本,本来都运行好好的,然后写了几行代码,而且也都确保每行都对齐了,但是运行的时候,却出现语法错误:
IndentationError: unexpected indent
【解决过程】
1.对于此错误,最常见的原因是,的确没有对齐。但是我根据错误提示的行数,去代码中看了下,没啥问题啊。
都是用TAB键,对齐好了的,没有不对齐的行数啊。
2.以为是前面的注释的内容影响后面的语句的语法了,所以把前面的注释也删除了。
结果还是此语法错误。
3.后来折腾了半天,突然想到了,把当前python脚本的所有字符都显示出来看看有没有啥特殊的字符。
当前用的文本编辑器Notepad++,好像有个设置,可以显示所有的字符的。
找到了,在:
视图 -> 显示符号 -> 显示空格与制表符
【python :编译错误】 IndentationError:unexpected indent(缩进问题)相关推荐
- Python编译时提示错误IndentationError: unexpected indent
新手小白刚开始学习Python,尝试想打印一句话,运行时提示 第19行 有个错误 IndentationError: unexpected indent print('a') 如上所示,indenta ...
- python :脚本运行出现语法错误:IndentationError:unexpected indent(缩进问题)
原文转载: https://www.jb51.net/article/153879.htm 今天在网上copy的一段代码,代码很简单,每行看起来该缩进的都缩进了,运行的时候出现了如下错误,Indent ...
- Python报错——IndentationError: unexpected indent
缩进问题,Python有严格的缩进规定,缩进空格相同代表并列. 原因一: 并列语句被缩进 # 错误示范 a=1b=2# 正确写法 a=1 b=2 原因二: 上下级关系无缩进 # 错误示范 if a== ...
- python报错“IndentationError: unexpected indent“的两三解决方法
这个是缩进错误,我们可以通过下面几步解决他: 首先检查代码是不是有错误的缩进 如果没有,全都正确,可以看看是不是使用'''进行了整段的注释,如果是,一定要保证其与上下相邻代码缩进一致,而#就无所谓 如 ...
- python提示IndentationError: unexpected indent错误
IndentationError为缩进错误,unexpected indent意外的缩进. 找到缩进错误的地方,进行修改即可. python 是用缩进来写模块.缩进的空白数量是可变的,必须严格执行所有 ...
- Python注释缩进不得当导致IndentationError: unexpected indent
def test():i=0 ''' aaaaaa '''while i < 5:'''bbbbbb''' print(i)i+=1if __name__ == '__main__':test( ...
- Python:IndentationError: unexpected indent
python遇到错误:IndentationError: unexpected indent解决办法:python因为是根据格式缩进来识别逻辑块的,所以对格式要求极为严格,出现上述错误,一般都是tab ...
- IndentationError: expected an indented block --python报错 or IndentationError:unexpected indent
https://blog.csdn.net/hanhanwanghaha宝藏女孩 欢迎您的关注! 欢迎关注微信公众号:宝藏女孩的成长日记 让这个可爱的宝藏女孩在努力的道路上与你一起同行! 如有转载,请 ...
- Python中报错:IndentationError: unexpected indent的原因分析和解决方法
Python中报错:"IndentationError: unexpected indent"的原因分析和解决方法 "IndentationError: unexpect ...
最新文章
- Oracle之comment关键字的详细讲解
- 启用日志调试Kerberos登录验证问题
- Text-CNN-文本分类-keras
- Windows10怎么在当前目录,打开cmd命令窗口?
- React入门指引与实战
- 2018年第九届蓝桥杯 - 省赛 - C/C++大学A组 - F.航班时间
- Flask--SQLAlchemy
- [PHP语法]PHP基础语法与数据类型
- 如何在命令行中使用jq将JSON转换为CSV
- SecureCRT无法登录Ubuntu
- anaconda中怎么sh_【好工具】 深度学习炼丹,你怎么能少了这款工具!JupyterLab 远程访问指南...
- php 安装phalcon,安装phalcon
- Linux学习笔记(单用户模式,救援模式,克隆主机,两个linux互相连接)
- socket编程(一)
- apache tuscany(一)
- php进销存bom,金太郎进销存带你了解BOM物料清单
- matlab表示网络,Matlab绘制网络
- 推荐几个面向 Web 开发者的杀手级网站
- 亚马逊广告授权流程说明
- [SDOI2009]学校食堂