[Solved] how to merge a number of lists in to one list [duplicate]


You can do:

old_list = [
['ID 1d6b:0002'],
['ID 1d6b:0002'],
['ID 1d6b:0001'],
['ID 1d6b:0001'],
['ID 1d6b:0001'],
['ID 1d6b:0001'],
['ID 1d6b:0001'],
['ID 0b38:0010'],
['ID 093a:2510']]


new_list = [x[0] for x in old_list]

This uses list comprehension to create a new list that contains the first elements ([0]) all on the lists in the old list.

Hope that helps.

2

solved how to merge a number of lists in to one list [duplicate]