Python doesn't understand %userprofile%

castironpi castironpi at gmail.com
Tue Jun 10 20:33:08 EDT 2008


On Jun 10, 6:51 pm, TheSaint <fc14301... at icqmail.com> wrote:
> On 00:11, mercoledì 11 giugno 2008 Tim Golden wrote:
>
> > "%USERPROFILE%/dir/file".
>
> os.environ('USERPROFILE') should return an info regarding that environment
> variable.
> I guess that, not yet tried.
> --
> Mailsweeper Home :http://it.geocities.com/call_me_not_now/index.html

I found:

from os import environ
r'%(HOMEPATH)s\My Documents\My Pictures\pycon.bmp'% environ

But 'os.join' is supposedly more correct.



More information about the Python-list mailing list