A list of lists: nested list : Nested List « List « Python






A list of lists: nested list

A list of lists: nested list
words = 'The quick brown fox jumps over the lazy dog'.split()

print words

stuff = [[w.upper(), w.lower(), len(w)] for w in words]

for i in stuff:
     print i

stuff = map(lambda w: [w.upper(), w.lower(), len(w)], words)

for i in stuff:
     print i

           
       








Related examples in the same category

1.Demonstrates nested sequencesDemonstrates nested sequences
2.Nest lists (create lists containing other lists)Nest lists (create lists containing other lists)