import subprocess output = subprocess.run(["cat", "data.txt"], capture_output=True) print (output.stdout)