[Python-ideas] Iterating non-newline-separated files should be easier
Antoine Pitrou
antoine at python.org
Sat Jul 19 16:55:43 CEST 2014
Le 19/07/2014 05:01, Steven D'Aprano a écrit :
>
> I open a file with some record-separator
>
> fp = open(filename, newline="\0")
Hmm... newline="\0" already *looks* wrong. To me, it's a hint that
you're abusing the API.
The main advantage of it, though, is that you can use iteration in
addition to the regular readline() (or readrecord()) method.
Regards
Antoine.
More information about the Python-ideas
mailing list