操作系统模块Python中提供了与操作系统交互的函数。操作系统属于 Python 的标准实用程序模块。该模块提供了一种使用操作系统相关函数的可移植方式。
操作系统.confstr_namesPython 中的对象是接受作为参数的名称的字典映射操作系统.confstr()方法来获取主机操作系统为这些名称定义的整数值。该对象用于确定系统已知的名称集。
注意: 操作系统.confstr_names对象仅在 UNIX 平台上可用。
用法:操作系统.confstr_names
参数:这是一个不可调用的对象。因此,不需要参数。
返回类型:该对象返回一个字典,其中包含操作系统已知的一组名称作为键,以及它们相应的整数值(由操作系统定义)作为值。
代码:os.confstr_names对象的使用
Python3
# Python program to explain os.confstr_names
# importing os module
import os
# importing pprint module
import pprint
# Get the dictionary mapping of
# names accepted by os.confstr() method
# to their corresponding integer values
# defined by host OS
names = os.confstr_names
# print the dictionary mapping
# using pprint
print("The list of names known to the operating system:")
pprint.pprint(names, width = 1)输出:
The list of names known to the operating system:
{'CS_GNU_LIBC_VERSION': 2,
'CS_GNU_LIBPTHREAD_VERSION': 3,
'CS_LFS64_CFLAGS': 1004,
'CS_LFS64_LDFLAGS': 1005,
'CS_LFS64_LIBS': 1006,
'CS_LFS64_LINTFLAGS': 1007,
'CS_LFS_CFLAGS': 1000,
'CS_LFS_LDFLAGS': 1001,
'CS_LFS_LIBS': 1002,
'CS_LFS_LINTFLAGS': 1003,
'CS_PATH': 0,
'CS_XBS5_ILP32_OFF32_CFLAGS': 1100,
'CS_XBS5_ILP32_OFF32_LDFLAGS': 1101,
'CS_XBS5_ILP32_OFF32_LIBS': 1102,
'CS_XBS5_ILP32_OFF32_LINTFLAGS': 1103,
'CS_XBS5_ILP32_OFFBIG_CFLAGS': 1104,
'CS_XBS5_ILP32_OFFBIG_LDFLAGS': 1105,
'CS_XBS5_ILP32_OFFBIG_LIBS': 1106,
'CS_XBS5_ILP32_OFFBIG_LINTFLAGS': 1107,
'CS_XBS5_LP64_OFF64_CFLAGS': 1108,
'CS_XBS5_LP64_OFF64_LDFLAGS': 1109,
'CS_XBS5_LP64_OFF64_LIBS': 1110,
'CS_XBS5_LP64_OFF64_LINTFLAGS': 1111,
'CS_XBS5_LPBIG_OFFBIG_CFLAGS': 1112,
'CS_XBS5_LPBIG_OFFBIG_LDFLAGS': 1113,
'CS_XBS5_LPBIG_OFFBIG_LIBS': 1114,
'CS_XBS5_LPBIG_OFFBIG_LINTFLAGS': 1115}
相关用法
- Python os.confstr()用法及代码示例
- Python os.chmod()用法及代码示例
- Python os.closerange()用法及代码示例
- Python os.chdir()用法及代码示例
- Python os.chflags()用法及代码示例
- Python os.chmod用法及代码示例
- Python os.chown()用法及代码示例
- Python os.chroot()用法及代码示例
- Python os.close()用法及代码示例
- Python os.cpu_count()用法及代码示例
- Python os.ctermid()用法及代码示例
- Python os.closerange用法及代码示例
- Python os.fdopen()用法及代码示例
- Python os.fpathconf()用法及代码示例
- Python os.getcwdu()用法及代码示例
- Python os.lchmod()用法及代码示例
- Python os.lstat()用法及代码示例
- Python os.pathconf()用法及代码示例
- Python os.popen()用法及代码示例
- Python os.tcsetpgrp()用法及代码示例
- Python os.tempnam()用法及代码示例
- Python os.tmpfile()用法及代码示例
- Python os.tmpnam()用法及代码示例
- Python os.kill()用法及代码示例
- Python os.getgrouplist()用法及代码示例
注:本文由纯净天空筛选整理自ihritik大神的英文原创作品 Python | os.confstr_names object。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
