[Chicago] is there really no built-in file/iter split() thing?

Carl Karsten carl at personnelware.com
Sat Dec 1 00:16:52 CET 2007


Michael Tobis wrote:
> def chunker(file,splitter=";"):
>    r = c = ""
>    while (c or not r) and (not c == splitter)
>       c = file.read(1)
>       r.append(c)
>    return r
> 
> I suspect I'm missing something to make this prettier, but
> file.read(1) seems to be the way to go through a file bytewise.

Aren't lines terminated with \n ?

Carl K


More information about the Chicago mailing list