[Chicago] is there really no built-in file/iter split() thing?
John Hunter
jdh2358 at gmail.com
Sat Dec 1 00:56:02 CET 2007
Could you describe in words what you are trying to do?
Sent via BlackBerry from T-Mobile
-----Original Message-----
From: "Michael Tobis" <mtobis at gmail.com>
Date: Fri, 30 Nov 2007 16:59:53
To:"The Chicago Python Users Group" <chicago at python.org>
Subject: Re: [Chicago] is there really no built-in file/iter split() thing?
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.
mt
_______________________________________________
Chicago mailing list
Chicago at python.org
http://mail.python.org/mailman/listinfo/chicago
More information about the Chicago
mailing list