LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   python - getting command result (https://www.linuxquestions.org/questions/programming-9/python-getting-command-result-574027/)

Hewson 08-01-2007 04:36 PM

python - getting command result
 
Greetings all,

I'm new to python and I need a way to get the results of a command, not the exit status. As an example take "ls" i'm looking for something like

output = someCommand("ls")

os.system is neat, but this gives me the exit status not the result of the command

Dan04 08-01-2007 06:22 PM

output = os.popen('ls').read()


All times are GMT -5. The time now is 07:45 AM.