I have two dicts through which I am creating two different lists and what I want is for them to be appended to a list without merging them so that I perform the operations on each list while iterating.
- Each list contains two slots which I need to use to run a command in order to blink a led on and off .
- I need the final output to be something like this : { 'first' : [slot1, slot2], 'second' : [slot1, slot2] } or simply { [[slot1, slot2], [slot1, slot2]] }
first_dict = {'address1': [1], 'address1': [2]}
second_dict = {'address2': [3], 'address2': [4]}
outlet_list1 = []
for x, slot in first_dict.items():
outlet_list1.extend(slot)
outlet_list2 = []
for x, slot in second_dict.items():
outlet_list2.extend(slot)
Can someone help to optimize and provide a solution for the mentionned problem ?