I have a large dictionary. I’d like to assign each key value pair to an attribute of a class. Currently I have something along the lines of the snippet below. It works, however it’s not pretty. Is there a better way to do this?
Pseudo-python snippet :
config = A large dictionary
self.Width = config['width']
self.Height = config['height']
self.Text = config['text']
self.Font = config['font']
etc...
Pretty simple:
You may want to do
key.title(), but instance attributes are suggested to be all lowercase in python.