Synthèse
The Describe function returns the following properties for tables. The Dataset property group is also supported. The Editor Tracking property group is supported if editor tracking has been enabled for this table.
Table properties are available in many types of Describe objects.
Propriétés
Propriété | Explication | Type de données |
hasOID (Lecture seule) | Indicates whether the table has an ObjectID field. | Boolean |
OIDFieldName (Lecture seule) | The name of the OID field if it exists. | String |
fields (Lecture seule) | A list of Field objects for this table. This is the same as using the ListFields function. | Field |
indexes (Lecture seule) | A list of Index objects for this table. This is the same as using the ListIndexes function. | Index |
Exemple de code
The following stand-alone script displays the OID field name if the table has one. It then prints the name and type for each field in the table.
import arcpy
# Create a Describe object from the table.
#
desc = arcpy.Describe("C:/data/chesapeake.gdb/munich")
# If the table has an OID, print the OID field name
#
if desc.hasOID:
print("OIDFieldName: " + desc.OIDFieldName)
# Print the names and types of all the fields in the table
#
for field in desc.fields:
print("%-22s %s %s" % (field.name, ":", field.type))
#print field.name + " = " + field.type
Vous avez un commentaire à formuler concernant cette rubrique ?