Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import arcpy
  2. from arcpy import env
  3. env.workspace = "S:/GISProgramming/Module5/Results/mod5.gdb"
  4. print ("Starting search cursor...")
  5. fc = "cities"
  6. fields = ['NAME', 'FEATURE', 'POP_2000']
  7. cursor = arcpy.SearchCursor(fc, "FEATURE = 'County Seat'")
  8. for row in cursor:
  9. print ("\nCity Name: " + row.getValue(fields[0]))
  10. print ("Feature Type: " + row.getValue(fields[1]))
  11. print ("Population for year 2000: " + str(row.getValue(fields[2])))
  12. print ("\nSearch cursor complete.")
  13. print(arcpy.GetMessages())
  14. print ("\n***********************************************************************")
  15.  
  16.  
  17. myDict = {}
  18. for row in cursor:
  19. myDict[row[0]] = row[1]
  20. #print ("\nCity Name: " + row.getValue(fields[0]))
  21. #print ("Feature Type: " + row.getValue(fields[1]))
  22. #print ("Population for year 2000: " + str(row.getValue(fields[2])))
  23. print (myDict)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement