Python: Start a new process replacing the current process
Python Operating System Services: Exercise-18 with Solution
Write a Python program to start a new process replacing the current process.
Python Code :
import os import sys program = "python" arguments = ["hello.py"] print(os.execvp(program, (program,) + tuple(arguments))) print("Goodbye")
print("Operating System Services Exercises-18")
Operating System Services Exercises-18
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to run an operating system command using the os module.
Next: Write a Python program to find out what the epoch is on a given platform. Also convert a given time in seconds since the epoch.
What is the difficulty level of this exercise?
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Python: Unpack a Tuple
>>> items = (0, 'b', 'one', 10, 11, 'zero') >>> a, b, c, d, e, f = items >>> print(f) zero >>> a, *b, c = items >>> print(b) ['b', 'one', 10, 11] >>> *_, a, b = items >>> print(a) 11
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework