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

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to