# Name: SaveToLayerFile_Example2.py
# Description: Saves an inMemory layer to a file on disk
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/data"
# Set local variables
in_features = "study_quads.shp"
where_clause = '"NAME" = 'LA MESA''
in_layer = "studyquadsLyr"
out_layer_file = "studyquadsLyr.lyr"
# Execute MakeFeatureLayer
arcpy.MakeFeatureLayer_management(in_features, "study_quads_lyr", where_clause)
# Execute SaveToLayerFile
arcpy.SaveToLayerFile_management("study_quads_lyr", out_layer_file, "ABSOLUTE")