[Tutor] Linux Home directory
Sandip Bhattacharya
sandip at linux-delhi.org
Fri Mar 12 21:37:59 EST 2004
Shitiz Bansal wrote:
> Hi,
> The required code is:
>
> import commands
> x= commands.getstatusoutput('echo $HOME')
>
> x[1] gives the value of required directory as string.
I think this is more portable. Should even work correctly on Windows.
>>> import os.path
>>> print os.path.expanduser("~")
/home/sandip
- Sandip
--
Sandip Bhattacharya
sandip (at) puroga.com
Puroga Technologies Pvt. Ltd.
Work: http://www.puroga.com Home: http://www.sandipb.net
GPG: 51A4 6C57 4BC6 8C82 6A65 AE78 B1A1 2280 A129 0FF3
More information about the Tutor
mailing list