文本文件属性

摘要

如果文本文件包含表格数据,Describe 函数会返回文本文件的表属性数据集属性,否则会参考文件属性。否则会参考文件属性

文本文件可返回 “TextFile”dataType

代码示例

文本文件属性示例(独立脚本)

以下独立脚本显示了一些具有表格数据的文本文件的文本文件属性。

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)

在本主题中