Skip to content

Instantly share code, notes, and snippets.

@mastier mastier/
Last active Dec 14, 2015

What would you like to do?
# useful way to flatten dictionary representing i.e. path to file and content
# now fixed in case of running it again
def flatten_dict(d,path=(),paths=None, sep='/'):
if paths==None: paths=[]
if isinstance(d,dict):
for k,v in d.items():
return paths
paths.append( { sep+sep.join(path) : d } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.