4
subprocess.Popen
을 사용하여 다음 명령을 어떻게 실행할 수 있습니까? subprocess.Popen을 사용하여 명령 파이프를 실행하십시오.
mysqldump database_name table_name | bzip2 > filename
나는
os.system()
일을 할 수 있습니다 알고 있지만 나는 메인 프로그램에 완료 덤프 기다릴 싶지 않다.
import subprocess
subprocess.Popen("sleep 4s && echo right thar, right thar",shell=True);
print 'i like it when you put it'
산출 :
I like it when you put it
[4 seconds later]
right thar, right thar