1、正常情况下是加一个缩进就行了

2、我这让在调试的时候出现一个特殊情况:

如下错误:60行需要一个缩进,看下图第二个代码,我这儿明明不需要再缩进,因为不是for循环里的,但是却提示需要一个缩进

  File "test_jacoco_report.py", line 60diffTree = ET.ElementTree(diffRoot)^
IndentationError: expected an indented block

如下是调试代码

def parseJacocoReportAndFilter(originReportXml, diffXml):46     print "originReportXml=", originReportXml, "diffxml=",diffXml, "fileArray=",fileArray47     originTree =  ET.parse(originReportXml)48     orginRoot = originTree.getroot()49     print orginRoot.tag,orginRoot.attrib50 51     diffRoot = ET.Element("report")52     for filterFile in fileArray:53     #   print "filterFile=", filterFile54     #   for sourceFile in originRoot.iter('sourcefile'):55     #       name = sourceFile.get('name')   56     #       if name == filterFile:57     #           print "....match = ", name58     #           diffRoot.append(sourceFile)59 60     diffTree = ET.ElementTree(diffRoot)61     diffTree.write("jacoco_define_output.xml")62     return63 64 print "begin use function def ..............."65 orginReportXml = "jacocoTestReport.xml"66 diffXMl = "jacoco_define_output.xml"67 parseJacocoReportAndFilter(orginReportXml, diffXMl)

解决:这是因为之前出了一个问题,我把for循环后的语句都屏蔽了,一个个查问题,现在for循环下没有任何语句,应该是for循环后跟的第一个语句是属于for循环的,所以这里第60行错把60行作为for循环的循环体了,把53行取消屏蔽,问题便解决了

python:IndentationError:expected an indented block相关推荐

  1. python问题:IndentationError:expected an indented block错误解决

    原文地址  http://blog.csdn.net/neilhappy/article/details/7724959 Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有 ...

  2. Python报错:IndentationError: expected an indented block

    IndentationError: expected an indented block 直译为:缩进错误:需要缩进的块 在Python中,函数间的判定归属由缩进的块来决定而不是一组组括号 出现这个错 ...

  3. python出现expected an_Python错误:IndentationError:expected an indented block怎么解决

    出现 IndentationError:expected an indented block 错误 一般是因为缩进问题引起的. 实例分析: 错误代码: >>> for key in ...

  4. 解决错误:IndentationError:expected an indented block

    这样的错IndentationError:expected an indented block说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行. 有冒号的下一行往往要 ...

  5. python错误:IndentationError: expected an indented block,教你一招搞定

    大家这个问题一般只出现与新手,大家都知道python一般都是靠缩进来区分,C语言都是用括号,每种语言都是不一样的,下面以一个最简单的代码来展示一下这种问题解决办法: 问题展示 问题:显示在代码第6行遇 ...

  6. Python : IndentationError: expected an indented block

    如下图 运行包报错: IndentationError: expected an indented block 处理方法是 问题原因 1冒号后面要跟要写一些内容的, 2 其他位置,或多或少空格的位置不 ...

  7. python 报错 IndentationError: expected an indented block SyntaxError: invalid character in identifie

    红色方框那里敲击一个空格就好! 输入要在全英情况下! 另外,还要注意括号的事情.括号别出错误! IndentationError: expected an indented block的报错: Syn ...

  8. python问题:IndentationError:expected an indented blo

    2019独角兽企业重金招聘Python工程师标准>>> Python语言是一款对缩进非常敏感的语言,给很多初学者带来了困惑,即便是很有经验的Python程序员,也可能陷入陷阱当中.最 ...

  9. Python报错“IndentationError: expected an indented block“

    问题描述: 一段python代码中使用了if name == 'main':,运行程序是报错"IndentationError: expected an indented block&quo ...

  10. 成功解决python中出现的IndentationError: expected an indented block的错误

    成功解决python中出现的IndentationError: expected an indented block的错误 目录 解决问题 解决思路 解决方法 解决问题 当在python中出现这个错误 ...

最新文章

  1. JAVA card 应用开发(二) 在项目添加APPLET
  2. 微软技术支持工程师_微软催你买电脑啦!即可+99元即可享受上门帮教服务
  3. php 字符串去html,PHP strip_tags() 去字符串中的 HTML、XML 以及 PHP 标签的函数
  4. 数据库的UNDO和REDO
  5. 转wordpress小工具制作前台后台全解析
  6. python staticmethod有什么意义_关于静态方法:python中的@staticmethod有什么意义?
  7. python程序写完后点哪个运行快_让 Python 代码运行更快的最佳方式!
  8. css 弹性盒子200304
  9. Oulipo(Hash入门第一题 Hash函数学习)
  10. 【从线性回归到BP神经网络】第四部分:BP神经网络
  11. Chrome浏览器离线安装包下载
  12. SQL查询时间段方法
  13. 老男孩之《生日快乐》
  14. mysql建立spj_数据库概论——SQL练习一(SPJ零件问题)
  15. 零基础入门金融风控之贷款违约预测—特征工程
  16. 数据库函数依赖与候选码求解
  17. 生成 Excel + PDF 导出,用 Java 怎么实现?
  18. 这可能是史上最全的 Python 算法集!| 技术头条
  19. iOS简易蓝牙对战五子棋游戏设计思路之二——核心棋盘逻辑与胜负判定算法
  20. png格式图片背景不透明问题解决

热门文章

  1. 云计算机房架构图,云计算架构技术与实践
  2. 2022最新 B站PC端下载视频方法
  3. win10共享打印机搜索不到计算机,大师告诉您Win10搜不到共享打印机的操作方案...
  4. Microsoft Word 教程:如何在 Word 中插入图片、图标?
  5. android源码分析!程序员怎样优雅度过35岁中年危机?送大厂面经一份!
  6. 电子学会机器人等级考试三四级考试大纲
  7. Android 7.0应用冷启动流程分析
  8. linux怎么限制文件大小,Linux文件系统文件大小限制
  9. excel转置怎么操作_Excel里掌握这些小技巧,让你的工作更轻松
  10. C# 批量修改文件名称