Returns a list of the feature classes in the current workspace, limited by name, feature type, and optional feature dataset.


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


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

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 feature type that will limit the results. Valid feature types are listed in the following table:

  • AnnotationAnnotation feature classes
  • ArcArc (or polyline) feature classes
  • DimensionDimension feature classes
  • EdgeEdge feature classes
  • JunctionJunction feature classes
  • Label Label feature classes
  • LinePolyline (or arc) feature classes
  • MultipatchMultipatch feature classes
  • MultipointMultipoint feature class
  • NodeNode feature classes
  • PointPoint feature classes
  • PolygonPolygon feature classes
  • PolylinePolyline (or arc) feature classes
  • RegionRegion feature classes
  • RouteRoute feature classes
  • TicTic feature classes
  • All All feature classes in the workspace. This is the default.

(La valeur par défaut est All)


Limits the feature classes returned to the feature dataset, if specified. If blank, only stand-alone feature classes will be returned in the workspace.

Valeur renvoyée
Type de donnéesExplication

The list containing feature class names is returned from the function, limited by the optional wild_card, feature_type, and feature_dataset arguments.

Exemple de code

ListFeatureClasses example

Copy shapefiles to a geodatabase.

import os
import arcpy

# Set the workspace for ListFeatureClasses
arcpy.env.workspace = "c:/base"

# Use the ListFeatureClasses function to return a list of
#  shapefiles.
featureclasses = arcpy.ListFeatureClasses()

# Copy shapefiles to a file geodatabase
for fc in featureclasses:
        fc, os.path.join("c:/base/output.gdb",
ListFeatureClasses example 1

List all feature classes in a geodatabase, including any in feature datasets.

import arcpy
import os

arcpy.env.workspace = "c:/base/gdb.gdb"

datasets = arcpy.ListDatasets(feature_type='feature')
datasets = [''] + datasets if datasets is not None else []

for ds in datasets:
    for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
        path = os.path.join(arcpy.env.workspace, ds, fc)

Rubriques connexes