What is the simplest way to create this list in Python?
First, suppose I have this nested list:
oldList = [ [{'letter':'a'}], [{'letter':'b'}], [{'letter':'c'}] ]
I want a function to spit out:
newList = [ {'letter':a}, {'letter':'b'}, {'letter':'c'} ]
Well, this could be done manually. However, what if there are three nested? …X nested
Tricky? 🙂
http://www.daniel-lemire.com/blog/archives/2006/05/10/flattening-lists-in-python/
from that link (with a couple minor changes: