【问题标题】:How to find the file system type in python如何在python中查找文件系统类型
【发布时间】:2011-02-17 13:14:38
【问题描述】:

我正在 python 中寻找一种方法来找出给定路径正在使用哪种类型的文件系统。我想以跨平台的方式做到这一点。在 linux 上,我可以获取 df -T 的输出,但这在 OSX 或 Windows 上不起作用。

【问题讨论】:

    标签: python windows macos filesystems


    【解决方案1】:

    请注意——不同的平台实际上是不同的。

    在 Mac OS X 和支持它的 Linux 上使用 lsvfs

    在 Windows 上使用 this

    使用 if 语句来决定。

    【讨论】:

      【解决方案2】:
      【解决方案3】:

      Linux 上的 os.popen('/sbin/fdisk -l /dev/sda')

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-12-01
        • 1970-01-01
        • 2012-11-24
        • 2011-01-29
        • 2020-10-02
        • 1970-01-01
        相关资源
        最近更新 更多