tools.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:pyfilesystem2 作者: PyFilesystem 项目源码 文件源码
def copy_file_data(src_file, dst_file, chunk_size=None):
    """Copy data from one file object to another.

    Arguments:
        src_file (io.IOBase): File open for reading.
        dst_file (io.IOBase): File open for writing.
        chunk_size (int, optional): Number of bytes to copy at
            a time (or `None` to use sensible default).

    """
    chunk_size = chunk_size or io.DEFAULT_BUFFER_SIZE
    read = src_file.read
    write = dst_file.write
    # The 'or None' is so that it works with binary and text files
    for chunk in iter(lambda: read(chunk_size) or None, None):
        write(chunk)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号