Krister Svanlund wrote:
On Sun, Jan 24, 2010 at 4:08 PM, Rotwang <sg...@hotmail.co.uk> wrote:
Hi all, can anybody tell me whether there's a way to change the default
location for files to be opened by open()? I'd like to be able to create
files somewhere other than my Python folder without having to write the full
path in the filename every time. Sorry if this is a stupid question, I don't
know much about programming.

Check out http://docs.python.org/library/os.html and the function
chdir it is what you are looking for.

Thank you. So would adding

import os
os.chdir(<path>)

to site.py (or any other module which is automatically imported during initialisation) change the default location to <path> every time I used Python?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to