Created
September 9, 2013 14:39
-
-
Save haya14busa/6496536 to your computer and use it in GitHub Desktop.
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
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