Saturday, June 9, 2018

Can you run operating system commands using Python?

Importing OS.path module in python you can run operating system commands. You can run such commands in Windows, Mac or Linux.

You can launch a program such as Notepad.exe from Python as shown here:


Python_OS_0

This brings up the Notepad.

You can get the environment using os.environ as shown here:



Python_OS_1

Here is a list of all things you can do with OS (Windows 10 OS) using Python 3.7:



OS_Python

Read more here:
https://docs.python.org/3/library/os.path.html

No comments: