mirror of https://github.com/tLDP/python-tldp
adding firstfoundfile function
This commit is contained in:
parent
c1c4b2b79c
commit
468f0f6317
|
@ -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'''
|
||||
|
|
Loading…
Reference in New Issue