0

I have a python script located in D:\Projects\. It has a code that downloads files from web. By default files are getting downloaded in the default current working directory and not in the directory from where the script is running i.e. D:\Projects\

import os
os.getcwd()

O/P: 'C:\\Users\\<user_name>'

Do I have to manually change the current directory to the directory from where the script using os.chdir(<path>) command. Is there any other alternative.

Atinesh
  • 1,790
  • 9
  • 36
  • 57
  • Err, the current directory _is_ where the script is running. Unless you're running it from a different path. – cs95 Aug 24 '17 at 12:02
  • In your case, the alternative would be to `chdir` into `D:\\Projects` and _then_ run your script. – cs95 Aug 24 '17 at 12:03

0 Answers0