Reading/Writing files

Dan Stromberg drsalists at gmail.com
Fri Mar 18 18:01:16 EDT 2011


For open() or os.open(), it should look in your Current Working Directory
(CWD).  Your python's CWD defaults to what the CWD was when python was
started, and it is changed with os.chdir().

Absolute paths will of course be relative to / on most OS's (or C:/ if
you're on C:, D:/ if you're on D:, etc. - IOW Windows is more complicated),
and relative paths will be relative to your CWD.

On Fri, Mar 18, 2011 at 2:33 PM, Jon Herman <jfc.herman at gmail.com> wrote:

> Hello all,
>
> I am pretty new to Python and am trying to write data to a file. However, I
> seem to be misunderstanding how to do so. For starters, I'm not even sure
> where Python is looking for these files or storing them. The directories I
> have added to my PYTHONPATH variable (where I import modules from
> succesfully) does not appear to be it.
>
> So my question is: How do I tell Python where to look for opening files,
> and where to store new files?
>
> Thanks,
>
> Jon
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110318/e22096d9/attachment-0001.html>


More information about the Python-list mailing list