Created
January 18, 2018 00:01
-
-
Save hunterwei/6b68f9ddfe4d3e0ebc1c5fe51a160f24 to your computer and use it in GitHub Desktop.
ArcPy snippet to copy values from one feature class to another feature class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
rows = arcpy.InsertCursor("TARGET_FEATURE") | |
sourcerows = arcpy.SearchCursor("SOURCE_FEATURE") | |
fields = arcpy.ListFields("SOURCE_FEATURE") | |
for sourcerow in sourcerows: | |
row = rows.newRow() | |
for field in fields: | |
if field.name != "OBJECTID": | |
row.setValue(field.name, sourcerow.getValue(field.name)) | |
rows.insertRow(row) | |
del fields | |
del sourcerows | |
del row | |
del rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment