Last active
March 3, 2017 08:33
-
-
Save shelomentsevd/5065c807fa305660324deb95764155ea to your computer and use it in GitHub Desktop.
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 os | |
from os import listdir | |
from os.path import dirname, realpath, isfile, isdir, isabs, join | |
def get_filenames(path): | |
if isabs(path): | |
dir_path = path | |
else: | |
dir_path = join( dirname(realpath(__file__)), path ) | |
if not isdir(dir_path): | |
raise ValueError('No such directory ' + dir_path) | |
files = [f for f in listdir(dir_path) if isfile(join(dir_path, f))] | |
return files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment