On Wed, 11 Aug 2010 12:13:29 +0100, Chris Withers wrote:

> Hi All,
> 
> I'm looking for a regex (or other solution, as long as it's quick!) that
> could be used to strip out lines made up entirely of whitespace.

def strip_blank_lines(lines):
    for line in lines:
        if not line.isspace():
            yield line

text = ''.join(strip_blank_lines(lines.split('\n')))


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

Reply via email to