Check fields data type before insertion to table

المشرف العام

Administrator
طاقم الإدارة
I am trying to insert a python list of tuples to arcgis table. there is type mismatch which is obvious. Each Value in tuples have different type and fields in table have different data types.

So, how can I loop through each field, check data type, perform type cast on each values in python tuples and insert them in table. Or is there easier way to do this ?

pylist= [(1.0, u'10',''), (2.0, 1.0, 2.0), (u'9', '', 2.0)] fields =["A", "B", "C"] #fields of arcgis table row = arcpy.da.InsertCursor(tablename, fields ) for i in range(len(pylist)): # here i need to have a routine which checks the data type of the field and perform type cast on tuple value before insertion row.insertRow(pylist)Any suggestion will be helpful.



أكثر...
 
أعلى