# Import system modules
print "Importing modules"
import arcpy
import os
# Check out extensions and Overwrite outputs
print "Checking for extensions and Overwrite outputs"
arcpy.CheckOutExtension("Analysis")
arcpy.CheckOutExtension("Data Management")
arcpy.env.overwriteOutput = True
# Input Parameters
print "checking input Parameters"
infeature = arcpy.GetParameterAsText(0)
delete_fields = arcpy.GetParameterAsText(1)
# Delete unwanted fields
print "Deleting unwanted fields"
arcpy.DeleteField_management (infeature, [delete_fields])
# Alter field alias by capitalising the initial letter of the word.
print "Changing the field alias by turning 1st letter of the word to uppercase"
fields = arcpy.ListFields(infeature)
for field in fields:
fname = field.name
alias = fname.title()
arcpy.AlterField_management (infeature, field, alias)
print "done"Hi Sephe Fox,
I have been trying to dig into this code to alter it to my specifications, but seems like I am lost. could you help me out with this please. Trying to create a script tool that allows you to delete fields and alter alias names.
Branched to new question by: Xander Bakker From original thread: https://community.esri.com/thread/151288