Select to view content in your preferred language

arcpy.ListFields

3883
5
03-23-2020 11:59 PM
KalSsin
Regular Contributor

 Hi~~~

 

I want the following text using the arcpy.

"OBJECTID", "EPOCH", "Shape_Length", "Shape_Area", "NAME", "PNAME"

0 Kudos
5 Replies
KalSsin
Regular Contributor

thank you~~~

This is the data I've already seen.

The table is being sent to Excel to obtain field name from Excel.

0 Kudos
JohannesBierer
Frequent Contributor

It's not really clear what you want to do? Feature Class to Excel you can use table to excel tool?

0 Kudos
DanPatterson_Retired
MVP Emeritus

The help files have good examples in both arcmap and arcgis pro

ListFields—ArcPy Functions | Documentation 

featureclass = r"c:\path\to_your\data\Geology"
field_names = [f.name for f in arcpy.ListFields(featureclass)]
JoshuaBixby
MVP Esteemed Contributor

Since reading the StackExchange thread didn't appear to help you understand how ListFields works, I will point out directly that ListFields doesn't return a list of field names, it returns a list of field objects.  If you want the names of the fields, you need to add the 2nd line of code in Dan's comment.