clean_lines(path) returning a list of every line with surrounding whitespace stripped, skipping lines that are empty after stripping.clean_lines('conf.txt') # file: 'host=a\n\n port=80 \n'['host=a', 'port=80']
The blank middle line is dropped; the others are stripped.
line.strip() both cleans and tests emptiness.
A comprehension over the file object works.