以下の例を参照してください。
import subprocess
p = subprocess.Popen(["ping", "localhost"], stdout=subprocess.PIPE)
output, err = p.communicate()
print output
出力:
Pinging w10-PC [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Ping statistics for ::1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
["tesseract", "--tessdata-dir", "/usr/share", "imagename", "outputbase", "-l", "eng", "-psm", "3"].
での例で["ping", "localhost"]
を交換しますが、さらに、ここでは詳細については、このexecute-shell-commands-in-python質問とPython 2.7 docをexamplesをチェックすることができます。
[Pythonで外部コマンドを呼び出す]の可能な複製(http://stackoverflow.com/questions/89228/calling-an-external-command-in-python) – sashoalm