How can I create a ramdisk in Python?

后端 未结 4 1086
小鲜肉
小鲜肉 2020-12-05 04:43

I want to create a ramdisk in Python. I want to be able to do this in a cross-platform way, so it\'ll work on Windows XP-to-7, Mac, and Linux. I want to be able to read/writ

4条回答
  •  再見小時候
    2020-12-05 04:54

    One option might be to inject (monkey patch) modified versions of the methods used in the os module as well as the builtins open and file that write to StringIO files instead of to disk. Obviously this substitution should only occur for the module being tested;

提交回复
热议问题