arcpy.env.workspace = r'C:\temp' rasterList = arcpy.ListRasters() for raster in rasterList: print raster # do something with these fc_list = arcpy.ListFeatureClasses() for fc in fc_list: print fc # do something with these
Using Arcpy, what test can I use to distinguish fc from raster?
arcpy.Describe(dataset).datasetType in ["RasterDataset","RasterBand"]
That list function should be only return feature classes. ListDatasets gives you both flavors. But to answer your question, the properties of an object are determined using the Describe function. You're looking for the "datasetType" property:arcpy.Describe(dataset).datasetType in ["RasterDataset","RasterBand"]