I have the following lista
that contains lists and strings:
['IBERDROLA', 'ACCOR\xa0SA', ['ADMIRAL'], ['ADECCO', 'IAG']]
I would like to make it a flat_list
with this output:
['IBERDROLA', 'ACCOR\xa0SA', 'ADMIRAL', 'ADECCO', 'IAG']
Probably I might not be using the correct keywords to find the desired answer, buy I only found
Making a flat list out of list of lists in Python
(with no str
like mines) into a flat_list
which gives the following output:
flat_list = [item for sublist in lista for item in sublist]
['I', 'B', 'E', 'R', 'D', 'R', 'O', 'L', 'A', 'A', 'C', 'C', 'O', 'R', '\xa0', 'S', 'A', 'ADMIRAL', 'ADECCO', 'IAG']