Canonical way of dealing with null-separated lines?

Scott David Daniels Scott.Daniels at Acm.Org
Thu Feb 24 12:01:12 EST 2005


Douglas Alan wrote:
> Is there a canonical way of iterating over the lines of a file that
> are null-separated rather than newline-separated?  Sure, I can
> implement my own iterator using read() and split(), etc., but
> considering that using "find -print0" is so common, it seems like
> there should be a more cannonical way.

You could start with this code and add '\0' as a line terminator:

     http://members.dsl-only.net/~daniels/ilines.html


--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list