Python 报错:IndentationError: unexpected indent
来源:互联网 发布:北京旅游 知乎 编辑:程序博客网 时间:2024/05/16 01:21
IndentationError: unexpected indent 是缩进的问题,也有可能是tab和空格混用啦
Python开发者有意让违反了缩进规则的程序不能通过编译,以此来强制程序员养成良好的编程习惯。并且在Python语言里,缩进而非花括号或者某种关键字,被用于表示语句块的开始和退出。增加缩进表示语句块的开始,而减少缩进则表示语句块的退出。缩进成为了语法的一部分。
根据PEP的规定,必须使用4个空格来表示每级缩进。使用Tab字符和其它数目的空格虽然都可以编译通过,但不符合编码规范。支持Tab字符和其它数目的空格仅仅是为了兼容很旧的Python程序和某些有问题的编辑器。
Python开发者有意让违反了缩进规则的程序不能通过编译,以此来强制程序员养成良好的编程习惯。并且在Python语言里,缩进而非花括号或者某种关键字,被用于表示语句块的开始和退出。增加缩进表示语句块的开始,而减少缩进则表示语句块的退出。缩进成为了语法的一部分。
根据PEP的规定,必须使用4个空格来表示每级缩进。使用Tab字符和其它数目的空格虽然都可以编译通过,但不符合编码规范。支持Tab字符和其它数目的空格仅仅是为了兼容很旧的Python程序和某些有问题的编辑器。
0 0
- python报错:IndentationError: unexpected indent
- Python 报错:IndentationError: unexpected indent
- python报"IndentationError: unexpected indent"
- python报"IndentationError: unexpected indent"的解决方法.
- python报"IndentationError: unexpected indent"的解决方法.
- IndentationError: unexpected indent python
- IndentationError: unexpected indent python
- IndentationError: unexpected indent python
- IndentationError: unexpected indent python
- python:IndentationError: unexpected indent
- IndentationError: unexpected indent python
- IndentationError: unexpected indent python
- Python的IndentationError: unexpected indent
- python错误:IndentationError: unexpected indent
- Python错误IndentationError: unexpected indent
- python 报错:unexpected indent
- python的IndentationError: unexpected indent python
- Python编程错误之IndentationError: unexpected indent
- SecureCRT自动连接及执行任务
- QThread with movetothread
- vi 保存复制内容格式粘贴
- SecureCRT自动重连服务器的解决方法
- Python向脚本传参
- Python 报错:IndentationError: unexpected indent
- Linux 查看内存,CPU及硬盘大小的方法
- Linux中用shell获取昨天、明天或多天前的日期
- 6. ZigZag Conversion Leetcode Python 2016 new Season
- 用户界面框架jQuery EasyUI示例大全之Tabs
- hadoop hdfs 添加数据目录出错
- xshell地址栏使用说明
- Saiku去掉登录模块
- Spark 1.X 大数据平台