Launch a shell command with in a python script, wait for the termination and return to the script

后端 未结 7 490
失恋的感觉
失恋的感觉 2020-11-28 22:09

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(\"myscri         


        
相关标签:
7条回答
  • 2020-11-28 23:09

    use spawn

    import os
    os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
    
    0 讨论(0)
提交回复
热议问题