[GIS] How to turn a python list into a table

arcgis-desktoparcpylistpythontable

I am trying to create a table of coded values so each textual description has a numerical attribute. The order of numbers is not important – they just need to be unique.

What I have so far is a python list of all unique values, so all I need to do now is add this to a table and create numbers. Is there a method in arcpy that will allow me to save my list as a table with an objectID?

Best Answer

To do this you should use a combination of ArcPy and Python.

You can use Python's enumerate function to get a number for each item in your list.

You use arcpy.da.InsertCursor() to create and populate a new row for each item in the list.

Related Question