import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
count = 0
for lyr in arcpy.mapping.ListLayers(mxd, "", df):
if count < 3:
count +=1
name = lyr.name
arcpy.FeatureClassToFeatureClass_conversion(lyr, r"C:\Temp", name + ".shp")
print "Finished Exporting"
del mxd, df, count, name
Not sure why the original comment came out in a single line, but here it is posted correctly. First, you'd still list the layers in the data frame on line 5. You could find which are rasters by following the Layer documentation. The name = lyr.name is from that documentation as well, basically just getting the name of the layer from the TOC. The original question was how to get the first x layers, so in the example, a variable is set to 0 to act as a counter, then the loop starts through all layers, adding 1 to the counter as it loops through each layer. Once the number of layers gone through is less than 3, continue on to export the feature class. To process rasters, switch the arcpy.FeatureClassToFeatureClass toop with the arcpy.CopyRaster tool or whatever other tool you want to use:
import arcpy, os
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
for lyr in arcpy.mapping.ListLayers(mxd, "", df):
if lyr.isRaster():
name = lyr.name
outRaster = os.path.join(r"C:\Temp","{0}.tiff".format(name))
arcpy.CopyRaster_management(lyr, outRaster)
print "Finished Exporting"
So line 4 loops through the layers, line 5 checks if it's of type Raster layer, line 6 gets the name of the layer from the TOC, line 7 uses the os.path.join function to construct the path to the output raster using the format function to create the output name, and line 8 runs the tool.