Get file's “get info” attributes in mac using python

女生的网名这么多〃 提交于 2019-12-02 12:14:38

问题


I have mounted a drive.

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

The location: /private/var/run/vmware/fuse/10323660103412696815/flat

How can I get this attribute using python?

os.stat does not give me this.


回答1:


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.



来源:https://stackoverflow.com/questions/11005303/get-files-get-info-attributes-in-mac-using-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!