LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Run external program from python script (https://www.linuxquestions.org/questions/programming-9/run-external-program-from-python-script-777304/)

MTK358 12-21-2009 03:45 PM

Run external program from python script
 
I want to be able to run a program in a python script, and capture it's output in a variable. I figured out that I can execute it with os.system(), but how do I capture it's output and store it in a variable?

ghostdog74 12-21-2009 06:26 PM

use the subprocess module.


All times are GMT -5. The time now is 08:03 PM.