En Thu, 22 May 2008 14:05:42 -0300, MRAB <[EMAIL PROTECTED]> escribió: > On May 22, 3:20 pm, [EMAIL PROTECTED] wrote:
>> > > In my case, what I'm doing is sending the return value through a >> > > socket: >> >> > > sock.send(f.read()) >> >> > I would go with: > > f = file("filename", "rb") > while True: > data = f.read(MAX_BUF_SIZE) > if not data: > break > sock.sendall(data) Another way is to use the shutil module: fin = open("filename", "rb") fout = sock.makefile() shutil.copyfileobj(fin, fout) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list