Request for tips on my first python script.

Maric Michaud maric at aristote.info
Fri Sep 8 13:56:47 CEST 2006


Le vendredi 08 septembre 2006 13:41, Sybren Stuvel a écrit :
> > HOME = os.path.expanduser("~")
>
> I wouldn't use this. Just use os.environ['HOME']. In most cases it
> turns out to be the same directory, but it adds more flexibility. If
> someone wants your app to read/write to another directory, he/she can
> simply change the HOME environment variable.

and ?

maric at redflag2 jeu sep 07 09:17:51:~/test$ export HOME=/etc
maric at redflag2 ven sep 08 13:53:17:/home/maric/test$ cd ~
maric at redflag2 ven sep 08 13:53:22:~$ pwd
/etc
maric at redflag2 ven sep 08 13:55:46:~$ python -c 'import os
> print os.path.expanduser("~")
> '
/etc


-- 
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097



More information about the Python-list mailing list