Python os.confstr_names
Python os.confstr_names 对象在Python中是作为参数接受的名称的字典映射。
os.confstr() 方法设置为主机操作系统为这些名称定义的整数值。此对象用于确定系统已知的名称集。
注意: os.confstr_names 对象仅在UNIX平台上可用。
语法: os.confstr_names
参数: 这是一个不可调用的对象。因此,不需要参数。
返回类型: 该对象返回一个字典,它将操作系统已知的一组名称作为键,并将它们对应的整数值(由操作系统定义)作为值。
示例1
使用os.confstr_names对象
# 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}