I am trying to create a simple code that will select features in a shapefile based on the query {anything within the ATTRIBUTE field that starts with the letter 'P'}. Here the problematic line:
arcpy.SelectLayerByAttribute_management("NJ_Wetlands", "NEW_SELECTION", """"ATTRIBUTE" LIKE P%""")
I know I could do this simply in the toolbox GUI, but I'm trying to learn arcpy. I'm obviously doing something wrong, and it shouldn't be very complicated. I get the error:
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.5\arcpy\arcpy\management.py", line 7713, in SelectLayerByAttribute raise e ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).