출처: http://forums.devshed.com/python-programming-11/run-external-program-in-python-363366.html
# simple
import os
# simple
import os
print os.system('example.exe')
# when we need to exchange std in/out
# when we need to exchange std in/out
import subprocess, os
import time
PIPE = subprocess.PIPE
p = subprocess.Popen("example.exe", stdin=PIPE, stdout=PIPE)
p.stdin.write("10")
time.sleep(0.1) # or p.wait(), without this line, deadlock happens
p.stdin.flush()
print p.stdout.read() #Deadlock
print "End of Execution"
os.system("PAUSE") 'Coding > Python Matlab' 카테고리의 다른 글
파이썬 - High-Resolution Mandelbrot in Obfuscated Python (0) | 2012.12.19 |
---|---|
파이썬 - enumerate (0) | 2012.12.18 |
파이썬 - python 2.7 print function usage (0) | 2012.10.10 |
파이썬 - 웹 링크 다운로드 (버퍼) (0) | 2012.03.13 |
파이썬 - multi-column data array (list) sorting (0) | 2012.02.24 |