Skip to content

Instantly share code, notes, and snippets.

View moshez's full-sized avatar

Moshe Zadka moshez

View GitHub Profile
def deepdict():
return collections.defaultdict(deepdict)
def deepdictify(tupdict):
res = deepdict()
for key, val in tupdict.items():
tempres = res
for kpart in key[:-1]:
tempres = tempres[kpart]
tempres[key[-1]] = val