[Pythonmac-SIG] Question on user's directory ( ~ )

Stewart Midwinter stewart.midwinter at gmail.com
Sun Mar 19 01:22:14 CET 2006


I have a question on use of the tilde symbol (~) to access the current
user's home directory.

If you are in a bash shell, you can "cd ~" and be in the default
user's home directory.

I want my python app to be able to switch to the user's directory. 
But I can't use os.chdir('~') since Python doesn't understand the
tilde.   Nor can I do this:
file = os.path.join('~', filename)

What options do I have?

thanks
S


More information about the Pythonmac-SIG mailing list