Last active
August 29, 2015 14:11
-
-
Save gispd/d8584a4dc10682ae19c7 to your computer and use it in GitHub Desktop.
A function to get a Geodatabase path from the feature class or table
This file contains 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
def get_geodatabase_path(input_table): | |
'''Return the Geodatabase path from the input table or feature class. | |
:param input_table: path to the input table or feature class | |
''' | |
workspace = os.path.dirname(input_table) | |
if [any(ext) for ext in ('.gdb', '.mdb', '.sde') if ext in os.path.splitext(workspace)]: | |
return workspace | |
else: | |
return os.path.dirname(workspace) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed typo