I have a sample script for a test shapefile (which I eventually will apply to an actual shapefile, but for simplicity I'll just use this) that I want to run outside of Arc as a standalone script.
Shape file name: TEST.shp
Attributes to Purge (in fclass): "A", "B", "C"
So with this script, I want all records that have an fclass containing A, B or C to be deleted and leaving everything else.
Here's where I have an issue. I can get this script to work with just one of the attributes, but not a combination of attributes (Sorry I can't seem to find a script code option to format this better):
import arcpy, os
shp = r'U:\TEST\TEST.shp'
list = ['1', '2', '3']
print "Purging unnecessary fclass values..."
with arcpy.da.UpdateCursor(shp, "fclass") as cursor:
for row in cursor:
#if row == "1": -- if I use just this, it works and deletes all rows with "1"
if row == [list]:
Using the if row == [list]: doesn't do anything and neither does if row == ["1","2","3"]: I also don't want to use multiple OR statements if I can help it, similar to this (though the syntax for python OR statements might not look like this):
if row == '1': OR
if row == '2': OR
if row == '3':
I've also played around using the different quotes as well in the script switching between the " and the ' without any success as well, thinking that was maybe the issue.
I am not getting any errors at all, but it's just not deleting the records at all either...