edwinzeae

How to convert cursor.search results into variables

Discussion created by edwinzeae on Mar 3, 2014
Latest reply on Mar 3, 2014 by hua17
Hello

I am quiet new on programing and I need some help. I want to read the values on a table a then turn them into a variable for future calculations. I have no problem with one result from the cursor.search (code bellow). But in some cases I have multiple results (up to 6) on the cursor.search. So how can I assign each of those 6 results to an independent variable ???

thanks in advance for your help

regards

EZ 8-D



 
with arcpy.da.SearchCursor(fc1, ("CountryID", "Total_Impact"), whereclause) as cursor:
    for row in cursor:
        # Access and print the row values by index position.
        #   Country name: row[0]
        #   Env Impact: row[1]
        #
        print('{0} has an impact in {1}'.format(row[0], row[1]))
        x = row[1]

Outcomes