Describe 对象属性 (arcpy)
摘要
Describe 函数将返回所有 Describe 对象的以下属性。
属性
属性 | 说明 | 数据类型 |
baseName (只读) |
The file base name | String |
catalogPath (只读) |
The path of the data | String |
children (只读) |
A list of sub elements | Describe |
childrenExpanded (只读) |
Indicates whether the children have been expanded | Boolean |
dataElementType (只读) |
The element type of the element | String |
dataType (只读) |
The type of the element | String |
extension (只读) |
The file extension | String |
file (只读) |
The file name | String |
fullPropsRetrieved (只读) |
Indicates whether full properties have been retrieved | Boolean |
metadataRetrieved (只读) |
Indicates whether the metadata has been retrieved | Boolean |
name (只读) |
The user-assigned name for the element | String |
path (只读) |
The file path | String |
代码实例
Describe object properties example (stand-alone script)
Display some Describe object properties for a file geodatabase.
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)
9/15/2013