Useful Libraries

Executing commands

subprocess

import subprocess

# Executing the "ls -la"  command:
s = subprocess.Popen(["ls", "-la"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

# unpacking the stdout and stderr
data, err = s.communicate()      

# printing the data to stdout
print(data)

os.system

import os

username = 'root'
ip_address = '10.10.10.161'

# Using os.system to ssh to a remote box
shell = "ssh -i " + '$HOME/.ssh/id_rsa ' + username+"@"+ip_address
os.system(shell)

Fancy Printing and Color

tabulate

termcolor

Graphing and Plotting Data

matplotlib

Last updated