Skip to content

Instantly share code, notes, and snippets.

@tjmichael81
Created June 19, 2015 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjmichael81/e90ed4bbdf6103d10eb6 to your computer and use it in GitHub Desktop.
Save tjmichael81/e90ed4bbdf6103d10eb6 to your computer and use it in GitHub Desktop.
Add number of fields to feature class with arcpy
import arcpy
fc = r'C:\folder\database.gdb\featureClass'
# fMax = number of fields that you need to create
# fNum = starting points
fMax = 300
fNum = 1
while fNum <= fMax:
# Add a new field to the feature class until fMax is reached
arcpy.AddField_management(fc, 'field_' + str(fNum), 'TEXT', None, None, 10)
print fNum
fNum = fNum + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment