Python os.get_exec_path() Method
Example
Print the list of directories present in PATH environment variable:
#Import os Library
import os
#print the controlling terminal of
the process
print (os.get_exec_path())
Try it Yourself »
Definition and Usage
The os.get_exec_path()
method returns the
list of directories, which are set in the PATH environment variable.
These directories are where the system will search for named executable programs.
Syntax
os.get_exec_path(env)
Parameter Values
Parameter | Description |
---|---|
env | Optional. Represents an environment variable dictionary to lookup in the PATH. |
Technical Details
Return Value: | A list value, representing all the
directories present in the PATH variable |
---|---|
Python Version: | 3.2 |
More Examples
Example
Print the list of directories for an environment variable:
#Import os Library
import os
# initialize the HOME environment
variable
env = {'HOME': '/home/testfolder'}
#print the
controlling terminal of the process
print (os.get_exec_path(env))
Try it Yourself »