I have a python dictionary with 2 lists like below
dict_ans={'Car':[['Toyota', 'Honda'], ['Ford','GM']],
'Truck':['Kenworth', 'Mack']
}
I am trying to get it in the format below:
dict_ans={'Car':['Toyota', 'Honda','Ford','GM'],
'Truck':['Kenworth','Mack']
}
I tried a few options in the link https://stackabuse.com/python-how-to-flatten-list-of-lists
But in each case the 'Truck'
resolves to ['K','e','n','w','o','r','t','h','M','a','c','k']
The Car
entry worked fine.
Any thoughts on the best way to achieve this?
Thanks!