I have a bunch of rasters with different file formats in a folder (most of them are GRID). Using describe of arcpy, I want my script to inform the following: when all rasters have the same format, inform once the file format e.g print "All the rasters has the XXX format", but when there are different formats, list the formats of each raster. I'm very new to scripting so by now the code I wrote print all the files with their format.
How can I do that?
The code block is:
for dpath, dnames, fnames in os.walk(lu_folder):
arcpy.env.workspace = dpath
print "\nThe format of LU rasters are:"
for raster in arcpy.ListRasters('*'):
desc = arcpy.Describe(raster)
print "{0}: {1}".format(raster, desc.format)