I am new to programming in ArcMap, and am using ArcMap 10.5. When I use the tool Select (Extract-Analysis Tool), the result is what I expect. However, When I run the Phyton Snipped code ArcMap displays: "Parsing error SyntaxError: invalid syntax (line 1)" I have searching the web with no success. Can you tell me how to fix this error? On the other hand, I have to apply the tool 130 times to export the polygons shapes one by one. How can I include the code in a for cycle?
arcpy.Select_analysis(in_features="D:/AKKGIS/cogo_plgs/001_130_cg_plgs.shp", out_feature_class="D:/ AKKGIS/img_clips/001_clp.shp", where_clause='"ppg_id" = '001'')
-
Remove the space in out feature class pathBera– Bera2018年05月16日 11:00:19 +00:00Commented May 16, 2018 at 11:00
1 Answer 1
You should change where_clause
into where_clause='"ppg_id" = \'001\''
. (added backward slashes)
You should use apostrophes and double quotes in right way. Please refer to that post: Arcpy query not working.