ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-tutor
python-tutor
Re: [Tutor] [Linux] open a file in any home "~" ?
by Alan Gauld other posts by this author
Apr 19 2006 12:30PM messages near this date
Re: [Tutor] [Linux] open a file in any home "~" ? | Re: [Tutor] [Linux] open a file in any home "~" ?
>  The ".myapp.conf" is in the home folder of the user.
>  ...
>  obviously I won't know the home user folder name then I wanted to use:
>  How can I do to access this file whatever the user is ?

You can get the user name using getpass.getuser() as described in 
the OS topic of my tutor under the Securiity heading.

You can also try using os.getenv() or the os.environ variable 
to look up the HOME environment variable, also discussed 
in the OS topic.

HTH,

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld


_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Learner404
Paidhi Aiji
K Weinert
Alan Gauld
Alan Gauld
W Chun
Learner404
W Chun
Matthew White

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved