Python os.confstr() Method
Example
Find the configuration value :
#Import os Library
import os
# Print the configuration value using os.confstr() method
print (os.confstr("CS_GNU_LIBC_VERSION") )
print (os.confstr("CS_PATH") )
Try it Yourself »
Definition and Usage
The os.confstr()
method returns string-valued system
configuration values.
Tip: Look at the os.confstr_names object to see the list of the names and integer values that is accepted as the name parameter.
Note: It is available only on UNIX platforms.
Syntax
os.confstr(name)
Parameter Values
Parameter | Description |
---|---|
name | Required. A string or an integer value representing a system configuration variable to retrieve. If the configuration variables defined by name is not defined by the system, it returns None, else ValueErrror exception is raised. Also, if configuration value is not supported by the host operating system, then OSError exception is raised. |
Technical Details
Return Value: | A str value, representing the system configuration values |
---|---|
Python Version: | 2.0 |