Text File properties (arcpy)

Summary

If the text file contains tabular data, the Describe function returns Table Properties and Dataset Properties for Text Files, otherwise refer to File Properties.

A Text File returns a dataType of "TextFile".

Code Sample

Text File properties example (stand-alone script)

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
6/21/2013