If someone could help me with this, I would forever be greatful. My preference is not to repeat DeleteField_management three times for the three diffrent feature classes, but to use a for loop and loop through all the feature classes except my creation will not work. Please help
Thanks, Larry
# Import arcpy module
import arcpy
# Local variables:
Arden = "C:\\Projects\\TestProject.gdb\\Project\\Arden"
Baypoint = "C:\\Projects\\TestProject.gdb\\Project\\Baypoint"
Clearlake = "C:\\Projects\\TestProject.gdb\\Project\\Clearlake"
mylist = Arden, Baypoint, Clearlake
for delete in mylist:
arcpy.DeleteField_management(mylist, "Pump;Well;Tank")
print "Finished the Delete Function"
Solved! Go to Solution.
It is helpful to post specific error messages, if any, as well.
Try changing your second to last line to:
arcpy.DeleteField_management(delete, ["Pump", "Well", "Tank"])
It is helpful to post specific error messages, if any, as well.
Try changing your second to last line to:
arcpy.DeleteField_management(delete, ["Pump", "Well", "Tank"])
Thanks Joshua,
Larry
I believe you're passing the wrong variable to DeleteField_management. You want to pass the current feature class in your loop ("delete"), not the list of feature classes you're looping over.
Thanks Earl, That was great information and it was enough to get me going again.
Larry