You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
482 B

# -*- coding: utf-8 -*-
"""
utils.Dict2Obj
~~~~~~~~~~~~~~
dic to class.
:copyright: 云南新八达科技有限公司.
:author: 李进才.
"""
class Dict2Obj(object):
"""
Turns a dictionary into a class
"""
# ----------------------------------------------------------------------
def __init__(self, dictionary):
"""Constructor"""
for key in dictionary:
setattr(self, key, dictionary[key])