# code to perform a command line command and store out put in a variable import subprocess as sp command = "whoami" output = sp.getoutput(command) print(output)