arcgis脚本报错:IndentationError:unexpectedindent
工具/原料
arcgis10.2
电脑Windows7操作系统
方法/步骤
1、首先,分析问题水貔藻疽,一般arcgis脚本中报错为:IndentationError:unexpectedindent,这种为代码的格式问题,行前空格不一致,格式不规范造成的。
2、然后,关闭提示,打开脚本。
3、再根据提示行列号,找到问题所在:foriinp:a=i.replace(&qu艺皱麾酪ot;-","f媪青怍牙")b=a.replace("/","f")abc=os.path.join(s,b)arcpy.Select_analysis(sss,abc,"DLMC='"+i+"'")cc=arcpy.ListFeatureClasses()
4、然后,对该段代码进行判断。很明显,b=a.replace("/","f")这一段,与其他段前空格数不一致。
5、再修改代码:foriinp:a=i.replace("-"巳呀屋饔,"f")b=a.replace("/",&q锇栀劐箨uot;f")abc=os.path.join(s,b)arcpy.Select_analysis(sss,abc,"DLMC='"+i+"'")cc=arcpy.ListFeatureClasses()删除b前空格。使其与上下一致(一般这种情况,前面比上一行多4个空格)
6、最后,保存脚本,重新运行该脚本,就不会再提示该错误了。