Deleting dirs after finishing a command prompt
I have a python script that ends with running a program (iexpress.exe) in a dos prompt.
The p开发者_Go百科rogram that runs in dos prompt, uses a dir called workdir. After the program has finished in the dos prompt I would like python to delete the dir. I have just made a simple solution of putting a delay of 30sec:time.sleep(30)
removeall(workdir)
os.rmdir(workdir)
But how should I do it, if python should delete the dir right after the process has finished?
Make the python program call the exe and not fall off the end
ie call the exe using subprocess.Popen
The when the exe finishes you are still in python
精彩评论