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配置有点问题 我在写代码的时候用 ...
随机推荐
- (一).JavaScript的简介,变量,数据类型,运算符和表达式
1. JavaScript的简介 1.1 JavaScript概念 JavaScript是一门:动态的 弱类型的 解释型 的脚本语言 1. 动态: 程序执行的时候才确定数据类型 2. 弱类型:数据类型 ...
- Delphi集合增删的另一种操作
D7 1 unit Unit1; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, ...
- (瞎学系列)RISC-V & ARM & x86
reduced instruction set computing (RISC) -> ARM & RISC-V complex instruction set computing (C ...
- Spring AOP的动态代理原理和XML与注解配置
AOP 实现底层就是对上面的动态代理的代码进行了封装,封装后我们只需要对需要关注的部分进行代码编写,并通过配置的方式完成指定目标的方法增强. 相关术语: Target(目标对象):代理的目标对象 Pr ...
- 编写简单的button配合input实现上传文件操作
<template> <button> 导入文件 <input type="file" @change="fileChange" ...
- mysql根据一个表更新另外一个表
-- 语法:update table_1 t1,table_2 t2 set t1.column = t2.column where t1.id = t2.pid; UPDATE house_test ...
- OO多项式求导作业总结
一.程序分析 1.1第一次作业 第一次作业是简单的多项式求导,甚至没有括号嵌套.但是,就是这个在如今看来如此简单的作业,由于俺寒假过于起飞,pre没做,正则表达式也不会(属实拉跨),一度想用c语言字符 ...
- Spring boot 入门-从idea 创建一个Spring boot应用!
1.File->New Project. http://start.springboot.io 2.下一步. 3.选择依赖. 4.生成项目. 5.运行. 6.设置Tomcat端口 src\mai ...
- Linux开发——spi总线学习
1 spi总线协议简介 1.1 基本概念 SPI(Serial pe)
- vite生成vue3项目
1.创建项目 npm init vite 2.根据提示输入项目名,也就是文件目录名,再选择框架 3.进入目录 npm install npm run dev 打完收工.