I take some lists from my database:
print(liste)
[('VEST', 'MODEL-1', 'BEIGE', 'M'),
('VEST', 'MODEL-1', 'BEIGE', 'S'),
('JACKET', 'MOD-1', 'GREEN', 'S'),
('JACKET', 'MOD-1', 'GREEN', 'M'),
('JACKET', 'MOD-2', 'BLACK', 'L'),
('JACKET', 'MOD-2', 'BLACK', 'XL')]
now I need to create a dict like this:
mydict = {'VEST' : {'MODEL-1' : {'BEIGE' : ('S', 'M')}},
'JACKET' : ({'MOD-1' : {'GREEN' : ('S', 'M')}},
{'MOD-2' : {'BLACK' : ('L', 'XL')}})}
I will use this in tkinter like json. I need to choose something like that:
print(mydict['JACKET'][1]['MOD-2']['BLACK'][0])
L
# Or
print(mydict['VEST']['MODEL-1']['BEIGE'][0])
S
How can I create a dict? I'm tired of trying different ways. I will be very happy if I can get good advice