Zusammenfassung
Returns a list of workspaces in the current workspace.
Auswertung
The workspace environment must be set before using several of the list functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.
Syntax
ListWorkspaces ({wild_card}, {workspace_type})
Parameter | Erklärung | Datentyp | ||||||
wild_card | Limits the results returned. If a value is not specified, all values are returned. The wildcard is not case sensitive.
| String | ||||||
workspace_type | The workspace type that will limit the results returned. The following are valid workspace types:
(Der Standardwert ist All) | String |
Rückgabewert
Datentyp | Erklärung |
String | The list containing workspace names that is returned from the function, limited by the wild_card and workspace_type arguments. |
Codebeispiel
ListWorkspaces example
Compact all file geodatabases in the workspace.
import arcpy
arcpy.env.workspace = "c:/data"
# List all file geodatabases in the current workspace
workspaces = arcpy.ListWorkspaces("*", "FileGDB")
for workspace in workspaces:
# Compact each geodatabase
arcpy.Compact_management(workspace)