lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix error messages in website build (issue4428077)


From: Graham Percival
Subject: Re: Fix error messages in website build (issue4428077)
Date: Thu, 5 May 2011 00:10:08 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, May 03, 2011 at 04:29:58PM +0100, Phil Holmes wrote:
> ----- Original Message ----- From: "Graham Percival"
> >python has .readlines() for a file, and generally it's
> >"pythonesque" to use lists.
> 
> Just looked at this.  readlines() leaves the newline character on
> the end of each string in the list and so therefore the filename
> isn't found in the list and therefore the error message is printed
> out.

Yes, I've been bugged by this for a while.  I finally did a google
search for "python readlines newlines" and found this:
http://stackoverflow.com/questions/544921/best-method-for-reading-newline-delimited-files-in-python-and-discarding-the-newl
which suggests:
    lines = open(filename).read().splitlines()

I'd rather use that method, and use lists for the names of files
to ignore.

Cheers,
- Graham



reply via email to

[Prev in Thread] Current Thread [Next in Thread]