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))

在本主题中