-1

Trying to flatten a list of lists into one list of unique values:

[[1, 2, 3], [4, 5, 6], [6, 7, 8]] into [1,2,3,4,5,6,7,8] where the first list might contain N number of lists.

ZtoYi
  • 180
  • 1
  • 1
  • 11
Wells
  • 10,415
  • 14
  • 55
  • 85
  • Do you mean that a sublist might *itself* contain lists? If so: http://stackoverflow.com/questions/2158395/flatten-an-irregular-list-of-lists-in-python – Alex Riley Oct 23 '15 at 21:24

1 Answers1

-1

You could try it like this:

a = [[1,2,3,4], [5,6,7,8]]

nxtList = []
for i in a:
    for j in i:
        nxtList.append(j)

This won't guarantee that your values are unique, but if you know ahead of time that the list (a) always contains unique values then it won't be a problem.

russOnXMaps
  • 159
  • 1
  • 10