Skip to content

Instantly share code, notes, and snippets.

@davehull
Created December 12, 2011 01:23
Show Gist options
  • Save davehull/1464048 to your computer and use it in GitHub Desktop.
Save davehull/1464048 to your computer and use it in GitHub Desktop.
Convert dictionary of file system metadata to a sorted list of dictionaries.
Takes the unsorted Python dictionary of file system metadata created by
git://gist.github.com/1463512.git and converts it to a sorted list of dictionaries containing
files and their metadata elements.
def get_meta_by_dir(dictionary):
# Sort the dictionary, return a list of dictionaries
items = [(pname, fname) for pname, fname in dictionary.items()]
items.sort()
return items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment