Adriaan Renting wrote:

> - print line, did remove the extra newlines, but didn't get rid of the
> blank lines.

You mean you found that

import fileinput
for line in fileinput.FileInput("test.xml", inplace=True):
    if line.strip():
        print line,

does not remove all blank lines? 

If the file contains lone carriage returns try "universal newlines" mode:

for line in fileinput.FileInput("test.xml", inplace=True, mode="U"):
    if line.strip():
        print line,


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

Reply via email to