ListDatasets (arcpy)

摘要

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.

讨论

必须先设置工作空间环境,之后才能使用多个列表函数,这些列表函数包括 ListDatasets、ListFeatureClasses、ListFiles、ListRasters、ListTables 和 ListWorkspaces。

语法

ListDatasets ({wild_card}, {feature_type})
参数说明数据类型
wild_card

通配符可限制返回的结果。如果未指定任何通配符,则会返回所有值。

String
feature_type

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

  • Coverage —Only coverages.
  • Feature —Coverage or geodatabase dataset, depending on the workspace.
  • GeometricNetwork —Only geometric network datasets.
  • Mosaic —Only mosaic datasets.
  • Network —Only network datasets.
  • ParcelFabric —Only parcel fabric datasets.
  • Raster —Only raster datasets.
  • RasterCatalog —Only raster catalog datasets.
  • Schematic —Only schematic datasets.
  • Terrain —Only terrain datasets.
  • Tin —Only TIN datasets.
  • Topology —Only topology datasets.
  • All —All datasets in the workspace. This is the default value.

(默认值为 All)

String
返回值
数据类型说明
String

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

代码实例

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

相关主题

9/15/2013