Is it possible to convert this:
[ [0], [1], [2], [3], [4], [5], [[6,9]], [7], [8], [[6,9]] ]
into this:
[ [0], [1], [2], [3], [4], [5], [6,9], [7], [8], [6,9] ]
Is it possible to convert this:
[ [0], [1], [2], [3], [4], [5], [[6,9]], [7], [8], [[6,9]] ]
into this:
[ [0], [1], [2], [3], [4], [5], [6,9], [7], [8], [6,9] ]
You can do:
x = [i[0] if (type(i[0])==list and len(i[0])>1) else i for i in a]
>>> a = [ [0], [1], [2], [3], [4], [5], [[6,9]], [7], [8], [[6,9]] ]
>>> x = [i[0] if (type(i[0])==list and len(i[0])>1) else i for i in a]
>>> x
[[0], [1], [2], [3], [4], [5], [6, 9], [7], [8], [6, 9]]