I often forget it, so make a note
home_directory.py
import os
print os.environ['HOME']
If it also supports win
from os.path import expanduser
home = expanduser("~")
Reference: https://stackoverflow.com/questions/4028904/how-to-get-the-home-directory-in-python
Recommended Posts