Using Python2.4 I want to capture output from a mysql command. One caveat is that I need to pipe the SQL statement using an echo.
echo 'SELECT user FROM mysql.user;' | mysql
I see example using call, os.system, popen but what is best to use for my version of python and capturing the output in a tuple.
Thanks
The subprocess module is the most flexible tool for running commands and controlling the input and output. The following runs a command and captures the output as a list of lines:
On Windows, bash -c would be replaced with cmd /c.