Noob python guy here.
So I have 22 geodatabases all in one folder. Each gdb has two feature classes. For each feature class, I need to rename a few of the fields. I've had success with this code, but it only works for each GDB at a time:
import arcpy
from arcpy import env
env.workspace = r'C:\...\filename.GDB'
for fc in arcpy.ListFeatureClasses('*'):
try:
arcpy.AlterField_management(fc, 'ADDR_SN', 'STREET_NAME', 'STREET_NAME')
except:
pass
As I said, that code is just for one GDB at a time, so I'd have to change the name in env.workspace each time. That's not a big deal, I just want to see if it's possible to iterate through every GDB in the folder. So I tried adding into the code:
for workspace in arcpy.ListWorkspaces('*', 'All'):
When I add the above code, I also change the env.workspace to the folder name that contains all the geodatabases, but nothing happens. No error is returned, nothing happens. Thanks for your help!
Aucun commentaire:
Enregistrer un commentaire