Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python | os.confstr_names object

  • Last Updated : 17 Jun, 2021

OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.confstr_names object in Python is a dictionary mapping of names accepted as parameter by os.confstr() method to the integer values defined for those names by the host operating system. This object is used to determine the set of names known to the system.
Note: os.confstr_names object is available only on UNIX platforms.
 

Syntax: os.confstr_names
Parameter: This is a non-callable object. Hence, no parameter is required. 
Return Type: This object returns a dictionary having set of names known to the operating system as key and their corresponding integer value (defined by operating system) as value. 
 

Code: Use of os.confstr_names object 
 

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)
Output: 
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}

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!