>>> subprocess.run(['ls', '-l'], stdout=subprocess.PIPE).stdout.decode('utf-8') 'total 0\n-rw-r--r-- 1 memyself staff 0 Mar 14 11:04 files\n'
References
https://stackoverflow.com/questions/4760215/running-shell-command-and-capturing-the-output
>>> subprocess.run(['ls', '-l'], stdout=subprocess.PIPE).stdout.decode('utf-8') 'total 0\n-rw-r--r-- 1 memyself staff 0 Mar 14 11:04 files\n'
References
https://stackoverflow.com/questions/4760215/running-shell-command-and-capturing-the-output