This is probably simple but I just can't seem to find the answer.
From the command line
mkdir ~/.foo
will make a directory .foo/ in the home folder of the current user.
in python
import os
os.mkdir("~/.foo")
Will die with an error
Code:
SyntaxError: invalid syntax
>>> os.mkdir("~/.foo")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OSError: [Errno 2] No such file or directory: '~/.foo'
Is there an easy way around this so I can write an app that will store config files in the users home directory without knowing the actual path of the users home directory?