I quite regularly want to create a dictionary where keys are variable names. For example if I have variables a
and b
I want to generate: {"a":a, "b":b}
(typically to return data at the end of a function).
Are there any (ideally built in) ways in python to do this automatically? i.e to have a function such that create_dictionary(a,b)
returns {"a":a, "b":b}