List comprehensions: map and tuple : List Comprehensive « List « Python






List comprehensions: map and tuple

List comprehensions: map and tuple
listoftuple = [('bob', 35, 'mgr'), ('mel', 40, 'dev')]

print [age for (name, age, job) in listoftuple]

print map((lambda (name, age, job): age), listoftuple)


           
       








Related examples in the same category

1.List comprehensions: for and tupleList comprehensions: for and tuple
2.List Comprehensions: a concise way to create lists
3.Define a function to construct listDefine a function to construct list
4.Find Prime numbers using listFind Prime numbers using list
5.List Comprehensions in buildConnectionString, Step by StepList Comprehensions in buildConnectionString, Step by Step