Select to view content in your preferred language

how to list the number in the attribute column

865
3
04-30-2013 05:54 PM
sxsxsxsx
Emerging Contributor
HI, I wanna list number in the column of OBJECTID_1, see the picture. I wrote it like this :

for row in arcpy.SearchCursor(fc):
                          print"%f" %row.getValue("OBJECTID_1")


what is wrong? Thanks



[ATTACH=CONFIG]23892[/ATTACH]
Tags (2)
0 Kudos
3 Replies
ChrisPedrezuela
Frequent Contributor
Did you want to create a list containing the values of that column?

valueList = list(i[0] for i in arcpy.da.SearchCursor(fc, ['FIELDNAME',]))



HI, I wanna list number in the column of OBJECTID_1, see the picture. I wrote it like this :

for row in arcpy.SearchCursor(fc):
                          print"%f" %row.getValue("OBJECTID_1")


what is wrong? Thanks



[ATTACH=CONFIG]23892[/ATTACH]
0 Kudos
ChrisPedrezuela
Frequent Contributor
Hi there,

That searchCursor is for 10.1 version by the way.

If you just wanted to print out the values,
cur = arcpy.da.SearchCursor(fc, ['FIELDNAME',])
for i in cur:
  print i[0]


Did you want to create a list containing the values of that column?

valueList = list(i[0] for i in arcpy.da.SearchCursor(fc, ['FIELDNAME',]))
0 Kudos
sxsxsxsx
Emerging Contributor
Thank for thanos_cp78's help. you are very knowledgeable!
0 Kudos