OS independent files

crystalattice crystalattice at gmail.com
Thu Aug 3 15:21:13 EDT 2006


I'm sure this has been addressed before but it's difficult to search
through several thousand postings for exactly what I need, so I
apologize if this a redundant question.

I've figured out how to use os.path.join to make a file or directory
location prior to pickling something to it.  But I have a question
about it.  In Windows I can make a file with this:

os.path.join("C:", "myfiles", "myfile.dat")

If I want to make sure the file/directory is made in a user's home
directory (e.g. /home/users/path/to/file) but also compatible w/
Windows, how would I rewrite this (if required)?




More information about the Python-list mailing list