python将内存映射为磁盘并从内存中将数据复制到磁盘


import fs

import fs.copy
def mer_to_disk():
    mem_fs = fs.open_fs('mem://')

    mem_fs.makedirs('fruit')
    mem_fs.makedirs('vegetables')

    with mem_fs.open('fruit/apple.txt', 'w') as apple:
        apple.write('braeburn')
    with fs.open_fs(".") as os_fs: 
        fs.copy.copy_fs(mem_fs, os_fs)
    mem_fs.close()
    




if __name__ == '__main__':
    mer_to_disk()
    原文作者:东方佑
    原文地址: https://blog.csdn.net/weixin_32759777/article/details/114997376
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞