ListFeatureClasses
摘要
Lists the feature classes in the workspace, limited by name, feature type, and optional feature dataset. A Python List is returned from the function.
讨论
必须先设置工作空间环境,之后才能使用多个列表函数,这些列表函数包括 ListDatasets、ListFeatureClasses、ListFiles、ListRasters、ListTables 和 ListWorkspaces。
语法
参数 | 说明 | 数据类型 |
wild_card |
通配符可限制返回的结果。如果未指定任何通配符,则会返回所有值。 | String |
feature_type |
The feature type to limit the results returned by the wild card argument. Valid feature types are:
(默认值为 All) | String |
feature_dataset |
Limits the feature classes returned to the feature dataset, if specified. If blank, only stand-alone feature classes will be returned in the workspace. | String |
数据类型 | 说明 |
String |
The Python List containing feature class names is returned from the function, limited by the optional wild card, feature type, and feature dataset arguments. |
代码示例
Copy shapefiles to a geodatabase.
import arcpy from arcpy import env import os # Set the workspace for the ListFeatureClass function # env.workspace = "c:/base" # Use the ListFeatureClasses function to return a list of # shapefiles. # fcList = arcpy.ListFeatureClasses() # Copy shapefiles to a file geodatabase # for fc in fcList: arcpy.CopyFeatures_management( fc, os.path.join("c:/base/output.gdb", os.path.splitext(fc)[0]))