Solved! Go to Solution.
A few things are going on here. In the last example, you ended the ListFields function with a } instead of starting it with a (. You should try setting the work space for your data. The code below works for me (Python 3). Make sure you are using the correct version of Python for things like the print statement.
import arcpy arcpy.env.workspace = 'C:/data/earthquakes.gdb' feature_class = 'earthquake_points' field_names = [f.name for f in arcpy.ListFields(feature_class)] print(field_names)
[f.name for f in arcpy.ListFields]
[ must match ] left and right brackets
A few things are going on here. In the last example, you ended the ListFields function with a } instead of starting it with a (. You should try setting the work space for your data. The code below works for me (Python 3). Make sure you are using the correct version of Python for things like the print statement.
import arcpy arcpy.env.workspace = 'C:/data/earthquakes.gdb' feature_class = 'earthquake_points' field_names = [f.name for f in arcpy.ListFields(feature_class)] print(field_names)
Thank you for your kind example.
I finally made it.