Custom Search

Monday, April 11, 2011

python how to get home directory

python how to get current user home directory or folder

import os
home_dir = os.path.expanduser("~")

OR

home_dir = os.getenv('USERPROFILE') or os.getenv('HOME')

No comments:

Post a Comment