Skip to content

Instantly share code, notes, and snippets.

@knu2xs
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knu2xs/8948022 to your computer and use it in GitHub Desktop.
Save knu2xs/8948022 to your computer and use it in GitHub Desktop.
list comprehension to collect all attribute field names in a variable
# get parameter
feature_class = arcpy.getParameterAsText(0)
# use list comprehension to list all field objects and access the name of the field
attribute_names = [field.name for field in arcpy.ListFields(feature_class)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment