I am trying to delete several feature classes from a file geodatabase using values stored in a user defined list.
The script runs without error but it does not delete the feature classes.
Any suggestions to what I am doing wrong (using ArcMap 10.3)?
import arcpy
arcpy.env.workspace = r"C:\Data\Temp.gdb"
fc_Delete = ["fcOut1a","fc_Out2a","fc_Out3a"]
for fc in fc_Delete:
if arcpy.Exists(fc):
arcpy.Delete_management(fc,"")
-
1Try removing the empty string parameter (ie. "") in the arcpy,delete functionMacroZED– MacroZED2017年01月03日 13:58:33 +00:00Commented Jan 3, 2017 at 13:58
-
Does the results window identify whether to Delete tool was executed or not? If so, the "messages" part will identify which feature class was deleted per iteration of the tool.reevesii– reevesii2017年01月03日 17:25:41 +00:00Commented Jan 3, 2017 at 17:25
1 Answer 1
Your code is correct, however I would remove the empty string part of the arcpy delete function.
ie:
arcpy.Delete_management(fc)
Vince
20.5k16 gold badges49 silver badges65 bronze badges
answered Jan 3, 2017 at 13:59
Explore related questions
See similar questions with these tags.
lang-py