Python 统计拥有文件夹权限的用户数

Python 统计拥有文件夹权限的用户数,python,Python,是否可以统计使用python访问文件的用户数 我已经用stat尝试了操作系统模块,但我不知道如何计算有权读取文件的用户数。既然您正在查找操作系统特定的信息,我倾向于建议直接使用shell命令 可以在python脚本中运行类似于此shell命令的命令 namei -o README.md | awk '{print $2}' | tail +2 # lists the users. awk chooses the 2nd column and tail skips the first line.

是否可以统计使用python访问文件的用户数


我已经用stat尝试了操作系统模块,但我不知道如何计算有权读取文件的用户数。

既然您正在查找操作系统特定的信息,我倾向于建议直接使用shell命令

可以在python脚本中运行类似于此shell命令的命令

namei -o README.md | awk '{print $2}' | tail +2 # lists the users. awk chooses the 2nd column and tail skips the first line.