adding firstfoundfile function

This commit is contained in:
Martin A. Brown 2016-02-22 12:32:16 -08:00
parent c1c4b2b79c
commit 468f0f6317
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,13 @@ def getLogger(**opts):
logger = getLogger()
def firstfoundfile(locations):
'''return the first existing file from a list of filenames (or None)'''
for option in locations:
if os.path.isfile(option):
return option
return None
def stem_and_ext(name):
'''return (stem, ext) for any relative or absolute filename'''