Indent----- IndentationError: unexpected indent
Unexpected indent 错误
注意,Python 中实现对代码的缩进,可以使用空格或者 Tab 键实现。但无论是手动敲空格,还是使用 Tab 键,通常情况下都是采用 4 个空格长度作为一个缩进量(默认情况下,一个 Tab 键就表示 4 个空格)
python是一种对缩进非常敏感的语言,最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分别的。


正确的写法应该是:
原因是if和else是同一层次的,然后print123和print456是同一层次的,所以他们二者的缩进也必须是一致的。。

Indent----- IndentationError: unexpected indent的更多相关文章
- [每日一记] Python报错 IndentationError: unexpected indent
IndentationError: unexpected indent 代码缩进出现错误 今天这个报错的原因是,早些时候的代码里Tab和空格混起来用了,,,[不是我...是编辑器的锅 不过我已经把Su ...
- python: indentationerror: unexpected indent
以后遇到了IndentationError: unexpected indent你就要知道python编译器是在告诉你“Hi,老兄,你的文件里格式不对了,可能是tab和空格没对齐的问题,你需要检查下t ...
- IndentationError: unexpected indent python
都知道python是对格式要求很严格的,写了一些python但是也没发现他严格在哪里,今天遇到了IndentationError: unexpected indent错误我才知道他是多么的严格. 以后 ...
- IndentationError: unexpected indent
都知道python是对格式要求很严格的,写了一些python但是也没发现他严格在哪里,今天遇到了IndentationError: unexpected indent错误我才知道他是多么的严格. ...
- python的IndentationError: unexpected indent python
都知道python是对格式要求很严格的,写了一些python但是也没发现他严格在哪里,今天遇到了IndentationError: unexpected indent错误我才知道他是多么的严格. ...
- 【python+selenium学习】Python常见错误之:IndentationError: unexpected indent
初入python+selenium学习之路,总会遇到这样那样的问题.IndentationError: unexpected indent,这个坑我已经踏进数次了,索性记录下来.都知道Python对代 ...
- python中遇到的问题:IndentationError: unexpected indent
在Python中写下列代码的时候,出现错误:IndentationError: unexpected indent 分析:IndentationError是缩进的错误,查看源代码发现names开始的这 ...
- Python脚本运行出现语法错误:IndentationError:unexpected indent
对于py来说典型错误就是缩进,,烦不胜烦,整理一下解决方法:一个python脚本,本来都运行好好的,然后写了几行代码,而且也都确保每行都对齐了,但是运行的时候,却出现语法错误: Indentation ...
- python遇到IndentationError: unexpected indent
由于tab和空格混用而导致的问题,解决办法如下: 在SubLime中View中的Identation中的Convert Indentitation to Spaces即可
- python ndentationError: unexpected indent
python 缩进搞了好久,每次都自己看了没什么问题 IndentationError: unexpected indent 每次都是这个错误. 后来查资料是vimrc配置有点问题 我在写代码的时候用 ...
随机推荐
- cerebro简单使用 , ES界面化工具 , 网页查看 , 操作索引
下载安装 下载地址 https://github.com/lmenezes/cerebro/releases 解压即用 , 目录中不能有空格和中文 需要jdk11及以上(实际我本机只有jdk8也能用) ...
- C Ⅸ
数组例子:统计个数 #include <stdio.h> int main(void) { int x; int count[10]; int i; ...
- create_generated_clock 的用法
本文转载自:create_generated_clock_亓磊的博客-CSDN博客_create_generated_clock 文章目录 参数source和master_clock区别 create ...
- Promise async await的用法实例一枚
getlog2() { console.log("222"); }, getlog3() { return new Promise((resolve, reject) => ...
- [Unity移动端]Mono与IL2Cpp
参考链接: https://blog.csdn.net/linxinfa/article/details/87358809 https://blog.csdn.net/Aison_/article/d ...
- el-admin登录详解
1.进入登陆界面后,就会自动获取验证码. 2.前端访问auth/code接口获取后端生成的验证码(包括uuid,img,结果值),然后放入redis,设置2分钟过期,并返回识别码.图片url给前端. ...
- 读取远程服务器linux指定目录下文本内容(工具类)
package com.aa.dataadmin.common.utils; import cn.hutool.extra.ssh.JschUtil; import com.jcraft.jsch.C ...
- zookeeper异常
1. KeeperErrorCode = Unimplemented for /service 在使用curator时,对zk有版本匹配关系. Curator 2.** <---> ...
- Python:logging简要版
日志等级(从低到高):DEBUG < INFO < WARNING < ERROR < CRITICAL 1.调试时,可记录DEBUG.INFO类的信息 2.投入使用,建议使用 ...
- 看看CabloyJS是如何异步加载并执行go wasm模块的
介绍 CabloyJS提供了一个内置模块a-wasmgo,将go wasm模块的异步加载运行机制进行了封装,使我们可以非常方便的在CabloyJS项目中引入go wasm,从而支持更多的业务场景开发 ...