I've a python script that has to launch a shell command for every file in a dir:
import os
files = os.listdir(".")
for f in files:
os.execlp("myscript", "myscript", f)
This works fine for the first file, but after the "myscript" command has ended, the execution stops and does not come back to the python script.
How can I do? Do I have to fork()
before calling os.execlp()
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…