Skip to main content

文本文件属性

汇总

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

对于文本文件, Describe dataType 属性将返回 "TextFile" 的值。

代码示例

文本文件属性示例

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

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)