在python中创建inode时,mode的每个字符是什么意思?

问题描述

关于使用Python创建文件/目录的指南很多,只是说将mode设置为0o777或其他内容,但是每个字符的实际含义是什么?

例如,在official documentation for the os python module中:

os.makedirs(name,mode = 0o777,exist_ok = False)

递归目录创建功能。类似于mkdir(),但是使所有中间级目录都包含叶子目录。

将模式参数传递给mkdir()来创建叶子目录;请参见mkdir() description了解其解释方式。

指向mkdir() description的链接,说明:

os.mkdir(path,mode = 0o777,*,dir_fd = None)¶

Create a directory named path with numeric mode mode.

If the directory already exists,FileExistsError is raised.

On some systems,mode is ignored. Where it is used,the current umask value is first masked out. If bits other than the last 9 (i.e. the last 3 digits of the octal representation of the mode) are set,their meaning is platform-dependent. On some platforms,they are ignored and you should call chmod() explicitly to set them.

This function can also support paths relative to directory descriptors.

It is also possible to create temporary directories; see the tempfile module’s tempfile.mkdtemp() function.

Raises an auditing event os.mkdir with arguments path,mode,dir_fd.

New in version 3.3: The dir_fd argument.

Changed in version 3.6: Accepts a path-like object.

...但是,这仍然没有定义0o777的含义以及所有可能的选项。

实际上在哪里记录了所有平台上模式值的所有可能选项以及它们的含义?

编辑:起初我以为第一个零是setuid位(但是在它和其余权限之间混有这个奇怪的“ o”),但是现在我认为0o只是紧随其后的八进制字符串的前缀。但是如果是这样的话,0o0754是否在所有平台上都有效? 实际上在哪里记录?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...