[Edu-sig] Teaching about files
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Mon Nov 8 07:09:14 CET 2004
On Sun, 7 Nov 2004, Kent Johnson wrote:
> So my question is, am I missing something here? Is f.read(n) important?
Hi Kent,
The most common use for f.read(n) in my personal experience has been in
conjunction with the 'md5' module on really large files. I have sometimes
done read(1), for character-by-character stuff. But otherwise, I tend to
use files as iterators.
I try to deemphasize read() and readlines(), as sucking a whole file as a
list isn't a technique that will scale well with large inputs.
Good luck!
More information about the Edu-sig
mailing list