2

When I use the arcpy.ListFields() command, a bunch of random numbers and letters are returned instead of my actual field names. I created my data set in Excel, used XY Table to Point, and exported it into a geodatabase as a feature class. I'm trying to use an UpdateCursor on this dataset but can't as the field names are not right. I'm using ArcGIS Pro.

enter image description here

user2856
73.6k7 gold badges123 silver badges207 bronze badges
asked Jul 25, 2019 at 21:45
1
  • Please use a light rather than black background for screenshots like these. Also, please always provide code and output as formatted text in preference to pictures. That way they are available to future searches and readable on all devices. Commented Jul 25, 2019 at 22:20

1 Answer 1

6

They're Field objects, you need to print the Field.name property:

[f.name for f in arcpy.ListFields(your_fc)]

Example from the Help:

Code sample

ListFields example - List field properties.

import arcpy
# For each field in the Hospitals feature class, print
# the field name, type, and length.
fields = arcpy.ListFields("c:/data/municipal.gdb/hospitals")
for field in fields:
 print("{0} is a type of {1} with a length of {2}"
 .format(field.name, field.type, field.length))
answered Jul 25, 2019 at 21:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.