I want to use arc py and the search cursor tool to display values from a field in my attribute table called 'NSA' inside a layer called 'Receiver_NSA_Label_Join'.
What is the code that I use to do this? Everything I have tried hasn't worked.
Solved! Go to Solution.
Assuming ArcGIS desktop and Python 2.x:
import arcpy
fc = 'Your_Feature_Class'
fields = ['Fields','You','Want']
with arcpy.da.SearchCursor(fc,fields) as cursor:
for row in cursor:
print row
If using ArcGIS Pro with python 3.x,change
print row
# to
print(row)
Assuming ArcGIS desktop and Python 2.x:
import arcpy
fc = 'Your_Feature_Class'
fields = ['Fields','You','Want']
with arcpy.da.SearchCursor(fc,fields) as cursor:
for row in cursor:
print row
If using ArcGIS Pro with python 3.x,change
print row
# to
print(row)
Thank you! Say I wanted to pull a certain value out of the field using the 'where clause'. How is that done?
If you are trying to use python to display labels on a map that get data from a related table in a one-to-many or many-to-many relationship then take a look at my Creating Labels with Related Table Data Blog.