ListDatasets

Récapitulatif

Lists all of the datasets in a workspace. Search conditions can be specified for the dataset name and dataset type to limit the Python List that is returned.

Discussion

The workspace environment must be set first before using several of the List functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.

Syntaxe

ListDatasets ({wild_card}, {feature_type})
ParamètreExplicationType de données
wild_card

Un caractère générique limite les résultats renvoyés. Si aucun caractère générique n'est spécifié, toutes les valeurs sont renvoyées.

String
feature_type

The feature type to limit the results returned by the wildcard argument. Valid dataset types are:

  • CoverageOnly coverages.
  • FeatureCoverage or geodatabase dataset, depending on the workspace.
  • GeometricNetworkOnly geometric network datasets.
  • MosaicOnly mosaic datasets.
  • NetworkOnly network datasets.
  • ParcelFabricOnly parcel fabric datasets.
  • RasterOnly raster datasets.
  • RasterCatalogOnly raster catalog datasets.
  • SchematicOnly schematic datasets.
  • TerrainOnly terrain datasets.
  • TinOnly TIN datasets.
  • TopologyOnly topology datasets.
  • AllAll datasets in the workspace. This is the default value.

(La valeur par défaut est All)

String
Valeur renvoyée
Type de donnéesExplication
String

A list containing dataset names returned from the function, limited by the wildcard and feature type arguments.

Exemple de code

ListDatasets example

List Feature Dataset names that start with C.

import arcpy

arcpy.env.workspace = "C:/Data"
# Print to the Interactive window all the feature datasets in the workspace
#   that start with the letter C. 
#
datasetList = arcpy.ListDatasets("C*", "Feature")

for dataset in datasetList:
    print dataset

Rubriques connexes


7/10/2012