I have a list with nested tuples, like the one below:
data = [('apple', 19.0, ['gala', '14', 'fuji', '5', 'dawn', '3', 'taylor', '3']),
('pear', 35.0, ['anjou', '29', 'william', '6', 'concorde', '4'])]
I want to flatten it out so that I can write a .csv file in which each item on every list corresponds to a column:
apple 19.0, gala 14 fuji 5 dawn 3 taylor 3
pear 35.0 anjou 29 william 6 concorde 4
I tried using simple flattening:
flattened = [value for pair in data for value in pair]
But the outcome has not been the desired one. Any ideas on how to solve this?