Describe 对象属性
汇总
Describe 函数将返回所有 Describe 对象的以下属性。
属性
| 属性 | 说明 | 数据类型 |
|---|---|---|
|
baseName (只读) |
文件基本名称。 |
String |
|
catalogPath (只读) |
数据的路径。 |
String |
|
children (只读) |
子元素列表。 如果描述工作空间,则 |
Describe |
|
childrenExpanded (只读) |
指示子元素是否已扩展。 |
Boolean |
|
dataElementType (只读) |
元素的元素类型。 |
String |
|
dataType (只读) |
元素的类型。 |
String |
|
extension (只读) |
文件扩展名。 |
String |
|
file (只读) |
文件名。 |
String |
|
fullPropsRetrieved (只读) |
指示是否已检索完整属性。 |
Boolean |
|
metadataRetrieved (只读) |
指示是否已检索元数据。 |
Boolean |
|
name (只读) |
元素的用户分配名称。 |
String |
|
path (只读) |
文件路径。 |
String |
代码示例
Describe 对象属性示例
显示文件地理数据库的某些 Describe 对象属性。
import arcpy
# Create a Describe object
desc = arcpy.Describe("C:/Data/chesapeake.gdb")
# Print some Describe Object properties
if hasattr(desc, "name"):
print("Name: " + desc.name)
if hasattr(desc, "dataType"):
print("DataType: " + desc.dataType)
if hasattr(desc, "catalogPath"):
print("CatalogPath: " + desc.catalogPath)
# Examine children and print their name and dataType
print("Children:")
for child in desc.children:
print("\t%s = %s" % (child.name, child.dataType))