I want to insert 25 new row into the existing shapefile of StreetsNortheast.and the code is familiar with the example of ArcGIS help: http://resources.arcgis.com/zh-cn/help/main/10.2/#/na/03q300000044000000/here is my code:
import arcpy# Create insert cursor for tablerows = arcpy.InsertCursor( r"K:\ESRIpractice\Esri certificate study\DesktopAssociate\Chapter10\Austin.gdb\StreetsNortheast")# Create 25 new rows. Set the initial row ID and distance valuesfor x in xrange(1, 26): row = rows.newRow() row.setValue("SEGMENT_ID", x) row.setValue("PREFIX_TYP","NEW") rows.insertRow(row)# Delete cursor and row objects to remove locks on the datadel rowdel rows but it returns this information:
Traceback (most recent call last):File "C:\Python Code\arcpy\module2.py", line 39, in row = rows.newRowAttributeError: 'str' object has no attribute 'newRow'Can anybody tell me why this error happened and how to fix it?
أكثر...
import arcpy# Create insert cursor for tablerows = arcpy.InsertCursor( r"K:\ESRIpractice\Esri certificate study\DesktopAssociate\Chapter10\Austin.gdb\StreetsNortheast")# Create 25 new rows. Set the initial row ID and distance valuesfor x in xrange(1, 26): row = rows.newRow() row.setValue("SEGMENT_ID", x) row.setValue("PREFIX_TYP","NEW") rows.insertRow(row)# Delete cursor and row objects to remove locks on the datadel rowdel rows but it returns this information:
Traceback (most recent call last):File "C:\Python Code\arcpy\module2.py", line 39, in row = rows.newRowAttributeError: 'str' object has no attribute 'newRow'Can anybody tell me why this error happened and how to fix it?
أكثر...