[Python-Dev] File Object Copy
Moshe Zadka
Moshe Zadka <moshez@math.huji.ac.il>
Wed, 12 Jul 2000 09:09:11 +0300 (IDT)
I've found a need for the following function:
def copyfile(fin, fout):
while 1:
buf = fin.read(4096)
if not buf:
break
fout.write(buf)
In several different places (modules I've written, SimpleHTTPServer uses
it, urllib has that code inlined somewhere, etc.)
(Of course, 4096 should be a parameter, but that's nits)
Can anyone suggest a module in which this function would belong?
--
Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez