[Tutor] Flattening multi-dimentional list

Bernard Lebel 3dbernard at gmail.com
Thu Sep 29 15:07:36 CEST 2005


Thanks for the examples and references everyone.

I should clarify though that I was simply looking for a *built-in*
feature rather than a function or a list-comprehension. I know these
last two works and I currently use a list comprehension.

# Example:
>>> flatten( [ 1, 3, 4, ('allo', 'bonjour', 'salut' ), 34, False,
False, ( 3, ) ]
[ 1, 3, 4, 'allo', 'bonjour', 'salut' , 34, False, False, 3 ]


Cheers!
Bernard


More information about the Tutor mailing list