>>> mystring = 'one, two, three, three three three, four four four, five, six'
>>> str_list = map(lambda s: s.strip(), mystring.split(','))
>>> my_nums = filter(lambda s: len(s.split()) <= 2, str_list))
>>> print my_nums
['one', 'two', 'three', 'five', 'six']
source
share