Created
July 8, 2022 13:04
-
-
Save mijorus/e79f36c1e9d9e893ce6b67a19a034248 to your computer and use it in GitHub Desktop.
Python create dict from variables names
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
# Credit: https://stackoverflow.com/questions/39818733/create-dictionary-where-keys-are-variable-names | |
def create_dict(*args: str): | |
return dict({i:eval(i) for i in args}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment