Get elements out of list in python
Question: Hi i just started with python and have a pretty nooby question.

I have a list which looks like this:

    
    
    [(1.0, 'Test1'), (1,3 'Test2'), (1.4 'Test3')]
    

How can i get only "Test1 Test2 Test3" as a return?

best regards


Answer: 
    >>> L = [(1.0, 'Test1'), (1.3, 'Test2'), (1.4, 'Test3')]
    >>> [x[1] for x in L]
    ['Test1', 'Test2', 'Test3']
    
    >>> " ".join(x[1] for x in L)
    'Test1 Test2 Test3'
    

You could also use `itemgetter(1)`, but the methods above would generally be
preferred

    
    
    >>> from operator import itemgetter
    >>> " ".join(map(itemgetter(1), L))
    'Test1 Test2 Test3'
    

