python是一种对缩进非常敏感的语言,最常见的情况是tab和空格的混用会导致错误,或者缩进不对,而这是用肉眼无法分别的。
==============================
将def 前面的空格去掉,然后对print做下tab空格,问题就解决了,如下图:

python报IndentationError: unexpected indent的解决方法.相关推荐

  1. python报“IndentationError: unexpected indent“的解决方法

    python报"IndentationError: unexpected indent"的解决方法 参考文章: (1)python报"IndentationError: ...

  2. python:IndentationError: unexpected indent 问题解决 图文说明

    转自:https://www.cnblogs.com/gary-bao/p/5142102.html Python脚本运行出现语法错误:IndentationError:unexpected inde ...

  3. Python 报错 SyntaxError: invalid syntax 解决方法

    Python 报错 SyntaxError: invalid syntax 解决方法 参考文章: (1)Python 报错 SyntaxError: invalid syntax 解决方法 (2)ht ...

  4. Python:IndentationError: unexpected indent

    python遇到错误:IndentationError: unexpected indent解决办法:python因为是根据格式缩进来识别逻辑块的,所以对格式要求极为严格,出现上述错误,一般都是tab ...

  5. python提示IndentationError: unexpected indent错误

    IndentationError为缩进错误,unexpected indent意外的缩进. 找到缩进错误的地方,进行修改即可. python 是用缩进来写模块.缩进的空白数量是可变的,必须严格执行所有 ...

  6. 【python :编译错误】 IndentationError:unexpected indent(缩进问题)

    转载:python :脚本运行出现语法错误:IndentationError:unexpected indent(缩进问题) 转载:TRACEING [问题]  一个python脚本,本来都运行好好的 ...

  7. Python中报错:IndentationError: unexpected indent的原因分析和解决方法

    Python中报错:"IndentationError: unexpected indent"的原因分析和解决方法 "IndentationError: unexpect ...

  8. IndentationError: expected an indented block --python报错 or IndentationError:unexpected indent

    https://blog.csdn.net/hanhanwanghaha宝藏女孩 欢迎您的关注! 欢迎关注微信公众号:宝藏女孩的成长日记 让这个可爱的宝藏女孩在努力的道路上与你一起同行! 如有转载,请 ...

  9. IndentationError: unexpected indent python

    在CentOS 6.3 64bit上一个没有配置好的vim中,修改了一个python脚本,运行时就反复报错,说 IndentationError: unexpected indent python 怎 ...

  10. Python注释缩进不得当导致IndentationError: unexpected indent

    def test():i=0 ''' aaaaaa '''while i < 5:'''bbbbbb''' print(i)i+=1if __name__ == '__main__':test( ...

最新文章

  1. 字符串作为freemarker模板的简单实现例子
  2. JQuery获取与设置HTML元素的内容或文本的实现代码
  3. 排序 (2)快速排序
  4. 数据库系列之T-SQL(触发器)
  5. 正念奇迹(一则正能量)
  6. 飞鸽传书人必须对自己守信
  7. 我靠这个数据分析利器,3年当上运营主管
  8. 航天生物计算机新能源你对哪个领域的课,写作《语言简明》课件.ppt
  9. 自学python需要安装什么-学Python需要安装什么软件?Python软件工具大全
  10. VS2019 EF6连接Mysql闪退以及实体框架版本问题
  11. 【OpenCV】-重映射
  12. UE4.26像素流公网访问linux和win两种实现方式
  13. 使用MindStudio进行MindX SDK财务票据OCR识别开发
  14. android 五种存储方式,android数据五种存储
  15. 到底什么是UI设计规范
  16. UBound 函数 (Visual Basic)
  17. 服务器如何接收GPS定位器发送过来的数据
  18. c语言格式化输入/输出%hhd、%hhx等
  19. C语言源文件名为什么无效,c语言源程序常错误分类及其改错.doc
  20. ST-LINK/V2烧录AT32芯片方法

热门文章

  1. Python 实验二 tkinter 版小学数学口算题生成器设计与实现
  2. 使用Python在Windows环境下切换输入法
  3. Kali安装中文输入法
  4. jvm虚拟机及创建对象流程
  5. 图扑软件数字孪生民航飞联网,构建智慧民航新业态
  6. 移动光猫怎么设置虚拟服务器设置,移动光猫如何设置自带的WIFI无线功能
  7. sensor gyro_3d not found
  8. linux隔离磁盘坏道,Repartion Bad Drive(硬盘坏道隔离工具
  9. Final Cut Pro X无法导入自家的MOV格式,解决方法。
  10. 如何升级到 macOS Mojave