1import os
2os.system('your command goes here')
The commands you can pass are operating system specific. For example, to clear the console screen in Windows, it’ll be
1os.system('cls')
and to clear the console screen in Mac it’ll be
1os.system('clear')
Both are OS specific commands for the same purpose.
You can read more about the os library in the Python documentation for os v15.1 in Python 2 and v16.1 in Python 3.
Win
1os.system('cls')
Mac
1os.system('clear')
Win
1os.system('mkdir dirNmae')
Mac
1os.system('mkdir dirName')
Win
1os.system('edit fileName')
Mac
1os.system('nano config.php')
Win
1os.system('del fileName')
Mac
1os.system('rm fileName')
Mac
1os.system('wget http://download/link/downloadName.tar.gz && mkdir folderName && tar zxvf downloadName.tar.gz --directory folderName && cd folderName')
Where: