ListWorkspaces
サマリー
Returns a list of workspaces in the current workspace.
ディスカッション
The workspace environment must be set before using several of the list functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.
構文
ListWorkspaces({wild_card}, {workspace_type})
| パラメーター | 説明 | データ タイプ |
|---|---|---|
|
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 |
|
workspace_type |
The workspace type that will limit the results returned.
|
String |
戻り値
| データ タイプ | 説明 |
|---|---|
|
String |
The list containing workspace names that is returned from the function, limited by the |
コードのサンプル
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.management.Compact(workspace)