The tuples inside the file:
(\'Wanna\', \'O\') (\'be\', \'O\') (\'like\', \'O\') (\'Alexander\', \'B\') (\'Coughan\', \'I\') (\'?\', \'O\')
here's a one line solution
>>> t = [ ('wanna', 'o'), ... ('be', 'o'), ... ('like', 'o'), ... ('Alexander', 'B'), ... ('Coughan', 'I'), ... ('?', 'o')] >>> x = [B[0] for B in t if B[1]=='B'][0] + ' ' + [I[0] for I in t if I[1]=='I'][0] >>> print x Alexander Coughan >>>