Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Search and Update Cursor Need help.

$
0
0
I am trying to update a shapefile by using search and update cursor.
It searchs great on of the shapefile but when I try to update the other it only retrieves the first data.
I am providing my code so anyone could tell me how to modify it.


Code:

import arcpy

fc = "C:/Users/hchapa.LRGVDC911.000/Documents/ArcGIS/Default.gdb/Test_Shapefile_SpatialJoin"
field = "parcel_1"


fc2 = "C:/GIS_DATA/Test_Shapefile.shp"


field2 = "parcel"
value = []
cursor = arcpy.SearchCursor(fc)
UpdateCursor = arcpy.UpdateCursor(fc2)



for row in cursor:
    value = row.getValue(field)
    for row2 in UpdateCursor:
        row2.setValue(field2, value)
        UpdateCursor.updateRow(row2)
   


print "Done"



the problem it only gets the first number but it doesnt iterate to the second number.

What am I doing wrong.

P.S I already try many other solutions nothing works.

I tried using a list.

Viewing all articles
Browse latest Browse all 2485

Trending Articles