如何在python中找到文件系统类型 [英] How to find the file system type in python

查看:169
本文介绍了如何在python中找到文件系统类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方式在Python中找出哪种类型的文件系统正在使用给定的路径。我想以跨平台的方式做到这一点。在Linux上,我可以只抓取 df -T 的输出,但是在OSX或windows上不起作用。提示 - 不同的平台实际上是不同的。



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

使用



使用if语句来决定。


I'm looking for a way in python to find out which type of file system is being used for a given path. I'm wanting to do this in a cross platform way. On linux I could just grab the output of df -T but that won't work on OSX or windows.

解决方案

Take the hint -- different platforms are actually different.

Use lsvfs on Mac OS X and those Linux that support it.

Use this on Windows.

Use an if-statement to decide.

这篇关于如何在python中找到文件系统类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆