Process calling

code.py
import os
import sys
import time
 
program = "python3"
print("Process calling")
arguments = ["xxxxxx.py"]
 
os.execvp(program, (program,) + tuple(arguments))
print("Good Bye!!")
time.sleep(5)

xxxxxx.py

print("hahhaha")

 

 

 
python3 code.py
outputs
macname@MacdeMBP files % python3 test.py
Process calling
hahhaha
macname@MacdeMBP files % 

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

posted @ 2020-12-23 22:37  anobscureretreat  阅读(156)  评论(0编辑  收藏  举报