ListRasters
Résumé
The ListRasters function returns a list of the rasters in the current workspace.
Discussion
The workspace environment must be set before using several of the list functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.
Syntaxe
ListRasters({wild_card}, {raster_type})
| Le paramètre | Explication | Type de données |
|---|---|---|
|
wild_card |
Limits the results returned. If a value is not specified, all values are returned. The wildcard is not case sensitive. Use an asterisk (*) to represent zero or more characters. For example, |
String |
|
raster_type |
Specifies the raster type that will be used to limit the results. The following are valid raster types:
|
String |
Valeur de retour
| Type de données | Explication |
|---|---|
|
String |
The list returned from the function containing raster names in the workspace, optionally limited by the |
Exemple de code
List Grid raster names in the workspace.
import arcpy
# Set the current workspace
arcpy.env.workspace = "c:/data/DEMS"
# Get and print a list of GRIDs from the workspace
rasters = arcpy.ListRasters("*", "GRID")
for raster in rasters:
print(raster)