Finding the user’s “My Documents” path

Use os.path.expanduser(path), see http://docs.python.org/library/os.path.html

e.g. expanduser('~/filename')

This works on both Unix and Windows, according to the docs.

Edit: forward slash due to Sven’s comment.

Leave a Comment