LoginSignup
36
28

More than 5 years have passed since last update.

pythonでホームディレクトリの取得

Last updated at Posted at 2014-01-19

よく忘れるのでメモ

home_directory.py
import os
print os.environ['HOME']

追記

winにも対応するなら

from os.path import expanduser
home = expanduser("~")

参考: https://stackoverflow.com/questions/4028904/how-to-get-the-home-directory-in-python

36
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
36
28