Skip to content

Instantly share code, notes, and snippets.

@XDo0
Created July 14, 2021 02:49
Show Gist options
  • Save XDo0/d771cb8d17a4889af3004f1327f55746 to your computer and use it in GitHub Desktop.
Save XDo0/d771cb8d17a4889af3004f1327f55746 to your computer and use it in GitHub Desktop.
Add to 2-D dict Python
def addtwodimdict(thedict, key_a, key_b, val):
if key_a in adic:
thedict[key_a].update({key_b: val})
else:
thedict.update({key_a:{key_b: val}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment