The 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.system() method execute the command (a string) in a subshell. This method is implemented by calling the Standard C function system(), and has the same limitations. If command generates any output, it is sent to the interpreter standard output stream. Whenever this method is used then the respective shell of the Operating system is opened and the command is executed on it.
command: It is of string type that tells which command to execute.
Return Value: On Unix, the return value is the exit status of the process and on Windows, the return value is the value returned by the system shell after running command.
Example #1 :
os.system() method to get current date of computer
Example #2 :
os.system() method to run Notepad.
- Difference between Method Overloading and Method Overriding in Python
- class method vs static method in Python
- Python | os.dup() method
- Python | set() method
- Python | next() method
- Python | os.ftruncate() method
- Python - PyTorch div() method
- Python | os.getcwd() method
- Python | os.sched_getaffinity() method
- Python | sympy.apart() method
- Python | os.renames() method
- Python | os.lseek() method
- Python | shutil.which() method
- Python PIL | getpixel() Method
- Python | os.minor() method
- Python | os.major() method
- Python | os.truncate() method
- GET method - Python requests
- Python | os.fsdecode() method
- Python | os.access() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.