Skip to content

Instantly share code, notes, and snippets.

@ghisprince
Created August 7, 2014 18:25
Show Gist options
  • Save ghisprince/d3d4123985ffea996781 to your computer and use it in GitHub Desktop.
Save ghisprince/d3d4123985ffea996781 to your computer and use it in GitHub Desktop.
pretty print table's fields
import arcpy
def pprint_fields(table):
""" pretty print table's fields and their properties """
def _print(l):
print("".join(["{:>12}".format(i) for i in l]))
atts = ['name', 'aliasName', 'type', 'baseName', 'domain',
'editable', 'isNullable', 'length', 'precision',
'required', 'scale',]
_print(atts)
for f in arcpy.ListFields(table):
_print(["{:>12}".format(getattr(f, i)) for i in atts])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment