Returns a list of datasets in the current workspace. Search conditions can be specified for the dataset name and dataset type to limit the list that is returned.


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


ListDatasets ({wild_card}, {feature_type})
ParameterExplanationData Type

Limits the results returned. If a value is not specified, all values are returned. The wildcard is not case sensitive.



Represents zero or more characters.

Te* finds Tennessee and Texas.


The type of dataset that will be returned.

  • CoverageOnly coverages.
  • FeatureCoverage or geodatabase dataset, depending on the workspace.
  • GeometricNetworkOnly geometric network datasets.
  • MosaicOnly mosaic datasets.
  • NetworkOnly network datasets.
  • ParcelFabricOnly parcel fabric datasets.
  • ParcelFabricForArcmapOnly ArcMap 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.

(The default value is All)

Return Value
Data TypeExplanation

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

Code sample

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.
datasets = arcpy.ListDatasets("C*", "Feature")

for dataset in datasets:
ListDatasets example 2

List feature dataset names that start with c or f, start with letters except c, or contain both c and f.

import arcpy
arcpy.env.workspace = 'c:/data'

# Print to the interactive window all the feature datasets in the
#   workspaces that start with the letter c or f.
datasets1 = list(set(arcpy.ListDatasets("c*", "Feature")) |
                 set(arcpy.ListDatasets("f*", "Feature")))

#   workspaces that start with the letters except c
datasets2 = list(set(arcpy.ListDatasets("*", "Feature")) -
                 set(arcpy.ListDatasets("c*", "Feature")))

#   workspaces that contain both the letter c and f
datasets3 = list(set(arcpy.ListDatasets("*c*", "Feature")) &
                 set(arcpy.ListDatasets("*f*", "Feature")))

Related topics