Text File properties


If the text file contains tabular data, the Describe function returns the Table and Dataset property groups for text files; otherwise, refer to the File property group.

For a text file, the Describe dataType property returns a value of "TextFile".

Exemple de code

Text file properties example

The following stand-alone script displays some text file properties for a text file that has tabular data:

import arcpy

# Create a Describe object from the text file.
desc = arcpy.Describe("C:/data/evac_table.txt")

# Print some table properties
print("HasOID: " + str(desc.hasOID))

print("\nField names:")
for field in desc.fields:
    print("   " + field.name)

Dans cette rubrique