(src, dst, length=None, exception=OSError, bufsize=None)
return
Copy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
Copy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
Copy length bytes from fileobj src to fileobj dst . If length is None copy the entire content .
def copyfileobj(src, dst, length=None, exception=OSError, bufsize=None):
    """Copy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    """
    bufsize = bufsize or 16 * 1024
    if length == 0:
        return
    if length is None:
        shutil.copyfileobj(src, dst, bufsize)
        return

    blocks, remainder = divmod(length, bufsize)
    for b in range(blocks):
        buf = src.read(bufsize)
        if len(buf) < bufsize:
            raise exception("unexpected end of data")
        dst.write(buf)

    if remainder != 0:
        buf = src.read(remainder)
        if len(buf) < remainder:
            raise exception("unexpected end of data")
        dst.write(buf)
    return
def copyfileobj ( src , dst , length = None , exception = OSError , bufsize = None ) : bufsize = bufsize or 16 * 1024 if length == 0 : return if length is None : shutil . copyfileobj ( src , dst , bufsize ) return blocks , remainder = divmod ( length , bufsize ) for b in range ( blocks ) : buf = src . read ( bufsize ) if len ( buf ) < bufsize : raise exception ( "unexpected end of data" ) dst . write ( buf ) if remainder != 0 : buf = src . read ( remainder ) if len ( buf ) < remainder : raise exception ( "unexpected end of data" ) dst . write ( buf ) return