这是这篇文章的后续。重申一下,我有一个文本文件,其中包含给定位置的元数据和测量数据。我想将此数据写入名为 ArcGIS 的空间映射软件,我必须为列表中的每个值指定ArcGIS 中定义的数据类型。例如:
type("foo")
在 Python 中给出,但在 ArcGISstr
中称为。text
因此,我想将列表中每个元素的数据类型转换为 ArcGIS 中的适当数据类型。像这样的东西:
# This is the raw data that I want to write to ArcGIS
foo= ['plot001', '01-01-2013', 'XX', '10', '12.5', '0.65', 'A']
# The appropriate datatypes in Python are:
dt= [str, str, str, int, float, float, str]
# In ArcGIS, the datatypes should be:
dtArcGIS= ['text', 'text', 'text', 'short', 'float', 'float', 'text']
问题是:我怎么能从dt
to 来dtArcGIS
?我在想一个dictionary
:
dtDict= dict{str:'text', int:'short', float:'float'}
但这会产生语法错误。任何帮助将不胜感激,谢谢!