Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created September 9, 2013 14:39
Show Gist options
  • Save haya14busa/6496536 to your computer and use it in GitHub Desktop.
Save haya14busa/6496536 to your computer and use it in GitHub Desktop.
import os
def getFileByListdir(path):
return [ f for f in os.listdir(path) if isfile(join(path,f)) ]
def getFileByWalk(path):
flist = []
for subdir, dirs, files in os.walk(path):
flist.extend(files)
return flist
def getSubDirectory(path):
#return [name for name in os.listdir(path) if os.path.isdir(os.path.join(dir, name))]
f = []
for name in os.listdir(path):
if os.path.isdir(os.path.join(path, name)):
f.append(name)
return f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment