This looks like a job for list comprehensions:

>>> returned_lines= ['Name: John, Value: 12','We don't want this one.','Name: 
>>> Eric, Value: 24']
>>> [x for x in returned_lines if ('Name' in x and 'Value' in x)]
['Name: John, Value: 12', 'Name: Eric, Value: 24']

List comprehensions are great. If you are not familiar with them, check
out the Python documentation. Once you get started with them, you won't
look back.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to