Skip to content

Instantly share code, notes, and snippets.

@yramagicman
Created February 19, 2015 04:53
Show Gist options
  • Save yramagicman/65e58134a8545bab407f to your computer and use it in GitHub Desktop.
Save yramagicman/65e58134a8545bab407f to your computer and use it in GitHub Desktop.
List comprehensions ftw
files = os.walk(file_location)
def getNames(files):
filtered = [i for i in files if '.git' not in i[0]]
names = []
for dirs in filtered:
names = names + [dirs[0] + '/' + d for d in dirs[2]]
return names
print getNames(files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment