How do I mount a filesystem using Python?

前端 未结 10 1957
鱼传尺愫
鱼传尺愫 2020-12-16 09:41

I\'m sure this is a easy question, my Google-fu is obviously failing me.

How do I mount a filesystem using Python, the equivalent of running the shell command

10条回答
  •  死守一世寂寞
    2020-12-16 10:04

    Mounting is a pretty rare operation, so it's doubtful that there is any direct python way to do it.

    Either use ctypes to do the operation directly from python, or else (and probably better), use subprocess to call the mount command (don't use os.system() - much better to use subprocess).

提交回复
热议问题