Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create a dict from variables and give name

mydict = NewClass()
vars = ['a', 'b', 'c']
for v in vars: 
    setattr(mydict, v, eval(v)) 

mydict.__dict__
{'a': 9, 'b': ['hello', 'world'], 'c': (True, False)}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #dict #variables #give
ADD COMMENT
Topic
Name
1+3 =