Created
December 7, 2015 16:29
-
-
Save mfurlend/8765d0e397f52c1d409a to your computer and use it in GitHub Desktop.
For ever layer, set every attribute field's value to the base file name of the layer.
Useful for later aggregating by field value.
This file contains hidden or 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 | |
from arcpy import env | |
env.workspace = "E:/master_regions" | |
files = arcpy.ListFiles("*.dbf") | |
for file in files: | |
rows = arcpy.UpdateCursor(file) | |
for row in rows: | |
row.NAME = file.split('.')[0] | |
rows.updateRow(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment