作者:wzcheng1984 | 来源:互联网 | 2023-05-18 18:54
Isthereapythonicwayandwithoutshellcommands(i.e.withsubprocessmodule)tocheckifadirec
Is there a pythonic way and without shell commands (i.e. with subprocess module) to check if a directory is a mount point?
是否有pythonic方式并且没有shell命令(即使用子进程模块)来检查目录是否是挂载点?
Up to now I use:
到目前为止我使用:
import os
import subprocess
def is_mount_point(dir_path):
try:
check_output([
'mountpoint',
path.realpath(dir_name)
])
return True
except CalledProcessError:
return False
1 个解决方案