This article demonstrates the usage of the ‘sorcery’ library in Python for generating dictionaries from variables. It includes a code snippet and refers to a related question on Stack Overflow for further assistance.

Use sorcery

1
2
3
4
import sorcery
a,b,c = 1,2,3
mydict = sorcery.dict_of(a,b,c)

Related question

Comments