How to mount a network directory using python?

前端 未结 4 1865
闹比i
闹比i 2021-02-08 19:47

I need to mount a directory \"dir\" on a network machine \"data\" using python on a linux machine

I know that I can send the command via command line:

mk         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-08 20:33

    Here is one way:

    import os
    
    os.cmd ("mkdir ~/mnt/data_dir mount -t data:/dir/ /mnt/data_dir")
    

    You can also use "popen" if you want to read the output of the command in your script.

    HIH

    ...richie

提交回复
热议问题