Skip to content

Instantly share code, notes, and snippets.

@rabbleNaut
Created April 10, 2014 14:46
Show Gist options
  • Save rabbleNaut/10390091 to your computer and use it in GitHub Desktop.
Save rabbleNaut/10390091 to your computer and use it in GitHub Desktop.
This script will allow the user to select a feature class and output the features Name, Alias, and Type to a .csv file. To be used in ArcGIS Modelbuilder.
'''
===========================
listAliases.py
4/8/2014
This script will allow the user to select a feature class and output the features Name, Alias, and Type to a .csv file.
Arguments:
0 - Input Featureclass
1 - Output Folder
============================
'''
import arcpy, os, csv
from arcpy import *
inputFC = GetParameterAsText(0)
outputFolder = GetParameterAsText(1)
desc = Describe(inputFC)
fp_out = open((outputFolder + os.sep + desc.name + "_desc" + ".csv"), "wb")
writer = csv.writer(fp_out, delimiter=",")
header = ["Name", "Alias", "Type"]
writer.writerow(header)
for field in desc.fields:
row = [field.name, field.aliasName, field.type]
writer.writerow(row)
fp_out.close()
AddWarning ("""
Your table has been output to the following location:
{0}
""" .format(outputFolder))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment