【发布时间】:2016-12-22 09:32:58
【问题描述】:
在 Windows 机器上,我正在尝试使用 python 中的 os 模块获取文件的模式,如下所示(短 sn-p):
import os
from stat import *
file_stat = os.stat(path)
mode = file_stat[ST_MODE]
我为文件获取的模式示例是 33206。
我的问题是,如何将其转换为 linux-file 模式方法? (例如,666)。
感谢所有回复者!
编辑:
在这里找到了我的答案 :) 对于所有想要进一步了解这个主题的人:
understanding and decoding the file mode value from stat function output
【问题讨论】:
标签: python file filesystems python-os