I have a dictionary that contains activities name and some characteristics of this activity.
I created a class called process and want to iterate in my dictionary creating processes.
process_name = ['processo1', 'processo2', 'processo3']
process_data = {
'processo1': {
'prod': 1.2,
'maquinario': 'maq1'
},
'processo2': {
'prod': 0.7,
'maquinario': 'maq2'
},
'processo3': {
'prod': 0.9,
'maquinario': 'maq3'
}
}
# ______________________________
class Process(object):
def __init__(self , dictionary):
for key in dictionary:
setattr(self, key, dictionary[key])
# ______________________________
for name in process_name:
processo = Process(process_data[name])
name = processo
It is creating the object with the name name
or process, not the name of the respective process.
How can I resolve this? Thank you!