itertools, functools, file enhancement ideas
rdhettinger at gmail.com
rdhettinger at gmail.com
Sun Apr 8 12:16:43 EDT 2007
[Paul Rubin]
> 1. File iterator for blocks of chars:
>
> f = open('foo')
> for block in f.iterchars(n=1024): ...
for block in iter(partial(f.read, 1024), ''): ...
> iterates through 1024-character blocks from the file. The default iterator
> a) def flip(f): return lambda x,y: f(y,x)
Curious resemblance to:
itemgetter(1,0)
Raymond
More information about the Python-list
mailing list