Last active
April 4, 2022 07:48
-
-
Save M-Bryant/7d07a16c31181d3b39b4e6b2962daaca to your computer and use it in GitHub Desktop.
arcpy: Check if field exists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arcpy | |
| def fieldExists(dataset: str, field_name: str) -> bool: | |
| """Return boolean indicating if field exists in the specified dataset.""" | |
| return field_name in [field.name for field in arcpy.ListFields(dataset)] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added type hinting