To change Definition Query in multiple MXD's try the following code:import arcpy, os
workspace = r"C:\tmp\MapProjects"
try:
for filename in os.listdir(workspace):
fullPath = os.path.join(workspace,filename)
if os.path.isfile(fullPath):
basename, extension = os.path.splitext(fullPath)
if extension.lower() == '.mxd':
mxd = arcpy.mapping.MapDocument(fullPath)
#here build your definition query as STRING eg.:
defQuery = '"OBJECTID" < 100'
#Replace YourLayerName with the layer name (String) which will be changed
for myLayer in arcpy.mapping.ListLayers(mxd, 'YourLayerName'):
myLayer.definitionQuery = defQuery
mxd.save()
except:
arcpy.GetMessages()
del mxd, myLayer