I am new to Python and ArcPy, but I would like to automate this process and/or make my code more efficient here. I am basically selecting a layer by attribute, then copying features from the (selected) layer, and then clearing the selection and starting over again with another layer. I need to do this for many layers in a row in my map document. I have attached my Python workflow for two layers below as an example.
>>> arcpy.SelectLayerByAttribute_management("Outlet_A", "NEW_SELECTION", "Struc_Rec = 'Major Repair'")
<Result 'Quad A\\OM_Rec\\Outlet_A'>
>>> arcpy.CopyFeatures_management("Outlet_A", "MajorRepairOutlet_A")
<Result 'X:/data.gdb\\MajorRepairOutlet_A'>
>>> arcpy.SelectLayerByAttribute_management("Outlet_A", "CLEAR_SELECTION")
<Result 'Quad A\\OM_Rec\\Outlet_A'>
>>> arcpy.SelectLayerByAttribute_management("Inlet_A", "NEW_SELECTION", "Struc_Rec = 'Major Repair'")
<Result 'Quad A\\OM_Rec\\Inlet_A'>
>>> arcpy.CopyFeatures_management("Inlet_A", "MajorRepairInlet_A")
<Result 'X:/data.gdb\\MajorRepairInlet_A'>
>>> arcpy.SelectLayerByAttribute_management("Inlet_A", "CLEAR_SELECTION")
<Result 'Quad A\\OM_Rec\\Inlet_A'>
for layer in listedlayers:
... And use select_analysis instead of select by attributes - copy features - unselect.