I want the following text using the arcpy.
"OBJECTID", "EPOCH", "Shape_Length", "Shape_Area", "NAME", "PNAME"
Could this help you?
arcgis pro - arcpy.ListFields() displaying numerical field names instead of actual field names - Geographic Information …
This is the data I've already seen.
The table is being sent to Excel to obtain field name from Excel.
It's not really clear what you want to do? Feature Class to Excel you can use table to excel tool?
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)]
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.
Retrieving data ...