-1
我有一個相當簡單的代碼,搜索面要素類和存儲數據,在列表中選擇字段:SearchCursor在ArcPy中返回元組和列表,不是列表
for eachSMField in smFieldList:
with arcpy.da.SearchCursor(seamaskPGN, eachSMField) as cursor:
for row in cursor:
cfbDataList.append(row)
print("### cfbDataList: ")
print(cfbDataList)
最後上面的代碼行給出以下輸出:
[[(4.1,)], [(4.2,)], [(4.34,)], [(4.45,)], [(4.55,)], [(4.58,)], [(4.68,)], [(4.75,)], [(4.78,)], [(4.83,)], [(4.87,)], [(4.89,)], [(4.91,)], [(4.96,)], [(5.03,)], [(5.09,)]]
雖然數據是準確的,我不能找出爲什麼數據是1)中的元組和2)每個元組是在他們自己的列表中,在更廣泛的列表。
我在尋找的輸出僅僅是在列表中的數據,例如:
[4.1, 4.2, 4.34, 4.45, ...etc]
+1感謝您的回答。 'eachSMField'存儲列表'smFieldList'的每個項目,這是一個靜態的字段名稱列表。 – DonkeyKong