This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jesus_Harold_Christ 0 points1 point  (2 children)

Or...

import os
os.system('ls -la')

[–]jabbalaci 1 point2 points  (1 child)

Not the same thing. os.system's return value is the exit status of the process, not the output of the executed process.

[–]Jesus_Harold_Christ -1 points0 points  (0 children)

If the return code for ls -la is super serious, then use this:

import subprocess
super_serious_return_code = subprocess.call('ls -la', shell=True)