I followed the top solution to Flattening an irregular list of lists in python (Flatten (an irregular) list of lists) using the following code:
def flatten(l):
for el in l:
if isinstance(el, collections.Iterable) and not isinstance(el, basestring):
for sub in flatten(el):
yield sub
else:
yield el
L = [[[1, 2, 3], [4, 5]], 6]
L=flatten(L)
print L
And got the following output:
"generator object flatten at 0x100494460"
I'm not sure which packages I need to import or syntax I need to change to get this to work for me.