in Arcpy trying to create a subset of rasters from a list of rasters.
Basically the idea, run arcpy.ListRasters on a geodatabase, check all raster names for a user input value, then add those rasters that match to a new list. ideally, the user would be able to add the values they want as a list of values and the code iterates through each one. And actually I'm trying to get it so it will refine the new list further. but I only really need the code to do the first one.
Code so far
listvals = arcpy.GetParameterAsText(0) listrasters = arcpy.ListRasters for raster in listrasters: rastname = str(raster) for val in listvals a = rastname.rfind(val,7,10) if a > 0: #add raster to newlist else: #do nothing