changing directory whist running python code -


this question has answer here:

i have piece of code runs 4 other pieces of code. when codes run write out put writes directory run code in. wondering if there way run code changes directory after every time, here code:

loop=np.arange(187761,187854) ext in loop:  ext=str(ext)  s0=''   dcom=["rm *.txt"]  dcom=s0.join(dcom)  nes=os.system(dcom)   a=sys.argv[1]  com=['cd /cygdrive/e/desar2.cosmology.illinois.edu+7443/desfiles/desardata/ops/red/', a,'/red/decam_00',ext, '/']  com=s0.join(com)  print com  sres=os.system(com)   com=['python /home/pythoncodes/other4.py ', '00'+ext]  com=s0.join(com)  print com  sres=os.system(com)   com=['python /home/pythoncodes/correctedmo.py ', '00'+ext]  com=s0.join(com)  print com  sres=os.system(com)   com=['python /home/pythoncodes/graphs.py ', '00'+ext]  com=s0.join(com)  print com  sres=os.system(com)   com=['python /home/pythoncodes/whiskerother4.py ', '00'+ext]  com=s0.join(com)  print com  sres=os.system(com) 

i hoping top part change directory every ext, doesn't. there way or should alter programs write different directories?

you can use os.chdir(path) change current directory.


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -