获取文件的“获取信息" Mac中使用python的属性 [英] Get file's "get info" attributes in mac using python

查看:106
本文介绍了获取文件的“获取信息" Mac中使用python的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了驱动器.

I have mounted a drive.

在获取信息"中,我有一个名为Image Disk

In it's "Get Info", I have an attribute named Image Disk

位置:/private/var/run/vmware/fuse/10323660103412696815/flat

如何使用python获取此属性?

How can I get this attribute using python?

os.stat没有给我这个.

推荐答案

使用xattr模块中的getxattr函数,该函数是Python与本机函数

Use the getxattr function from the xattr module, which is a Python binding to the native function getxattr(2). For example:

import xattr
print xattr.getattr('/Volumes/MyDrive', 'Image Disk')

请参见此博客帖子以获取更详细的示例.

See this blog post for a more detailed example.

这篇关于获取文件的“获取信息" Mac中使用python的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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