>>> import subprocess
>>> proc = subprocess.Popen(['ls', '-al'], stdout=subprocess.PIPE)
>>> output = proc.stdout.read()
>>> print(output)
total 3
drwxrwxrwx 1 root root 111111 Sep 11 01:11 dir1
-rwxrwxrwx 1 root root 222222 Nov 22 02:22 file1
-rwxrwxrwx 1 root root 333333 Oct 30 03:33 file2