Saturday, 9 February 2008

python change working directory

Sometimes this concept of working directory is essential, especially when calling another system or executable programs.

import os

os.chdir('c:\\thepath\\')
os.system('the command') # otherwise, if the command need to read some file within same folder, the command can not find it, because the needed file is not in the current working directory.


Powered by ScribeFire.

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter