Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please write the code with Python The shell environment variable $PATH contains a delimiter-separated sequence of directory paths (the delimiter varies between platforms). The shell
please write the code with Python
The shell environment variable $PATH contains a delimiter-separated sequence of directory paths (the delimiter varies between platforms). The shell uses the content of this variable to determine where to look for executables that correspond to commands entered at the command line. You can view this on Linux using the command: echo $PATH (using Windows CMD it's: echo $PATH?). Write a function named decompose_path() that takes a single string argument, named path. path will contain the contents of the PATH environment variable as returned by the echo $PATH command. Use a regular expression to create a list of each directory in PATH. The function should return that list. For example: path = "/usr/openwin/bin:/usr/ucb:/usr/bin:/bin:/etc:/usr/local/bin:/us r/local/lib:/usr/shareware/bin:/usr/shareware/lib: ." returns = ["/usr/openwin/bin", /usr/ucb", "/usr/bin", "/bin", "/etc", "/usr/local/bin", "/usr/local/lib", "/usr/shareware/bin", "/usr/shareware/lib", "."]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started