I'm trying to apply the following code to extract features that contain these letters 'MW' within the field called 'CODE' for multiple layers. But I'm getting a SyntaxError for line 5 (defintion query).
import arcpy
mxd = arcpy.mapping.MapDocument("Current")
layers = arcpy.mapping.ListLayers(mxd)
for layer in layers:
if layer.supports(definitionQuery)
layer.definitionQuery = ""CODE" LIKE "('%MW%')"
"""CODE LIKE '%MW%'"""
. You may also have to add quotes around CODE depending on the field and data type. I'm not sure if arcpy.AddFieldDelimiters works on layers.