On 18/03/2011 5:33 PM, Jon Herman wrote:
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?

This is how you write to a file in Python

myfile = open("path/to/the/file", "wb")
myfile.write("Hello world!\n")
myfile.close()

Beyond that, your message is too vague to offer any real help, but it sounds like you're way off track. If the above code doesn't help, please tell us exactly what you're trying to do, but you might want to read a Python book such as Dive Into Python first.

Cheers,

Matt


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to