Select to view content in your preferred language

Field names and field descriptions

398
1
01-15-2020 11:26 AM
Pak_YenLim
New Contributor

How to export field names and field descriptions of a featureclass?

0 Kudos
1 Reply
JoeBorgione
MVP Emeritus

arcpy.ListFields() will give you a list of field names:  ListFields—ArcPy Functions | ArcGIS Desktop 

if by description you mean type, that's in there too....

import arcpy

fc = r'N:\GIS\Geocoding\Geodata.gdb\rawAddresses'


for field in arcpy.ListFields(fc):
    print(f'{field.name}  {field.type}  {field.length}')

#returns a list that looks like this:

OBJECTID  OID  4
ADDR_HN  String  12
ADDR_PD  String  12
ADDR_SN  String  60
ADDR_ST  String  40
ADDR_SD  String  12
PARCEL  String  30
UNIT_DESIG  String  10
BLDG_DESIG  String  10
ADDRESS  String  45
IDENTIFY  String  75
ADDR_LABEL  String  65
CITY  String  30
ZIP_CODE  String  10
CORNER_ADDRESS  String  70
PLAT_NUM  String  15
SUB_PLAT  String  70
LOT_NUM  String  15
BLOCK_NUM  String  10
DEVELOPMENT  String  75
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
That should just about do it....
0 Kudos