[Level 1] How to get user home directoy in Python

#!/bin/env python
import os
print os.path.expanduser('~')
print os.path.expanduser('~stanley')
print os.environ['HOME']
./getUserHomeDirectory.py 
/home/stanley
/home/stanley
/home/stanley
Wish this helps.
regards,
Stanley Huang

Comments

Popular posts from this blog

[Level 2] Shell Interactive With Zenity Episode 5 -- list

[Level 2] iif in Python