Last active
November 13, 2017 22:07
-
-
Save pykong/460998d2dca5b5f4a8418e6ba70738dc to your computer and use it in GitHub Desktop.
Use this logic instead of a sequence of key checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l0 = {} | |
l1 = l0.setdefault("key_l1", {}) | |
l2 = l1.setdefault("key_l2", []) | |
l2.append("3") | |
{'key_l1': {'key_l2': ['3']}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment