%SystemDrive%

Atanas Banov enterr at gmail.com
Thu Feb 16 03:29:42 EST 2006


Bryan Olson wrote:
> To get it with the \, you might use:
>
>      os.path.abspath(os.environ['SYSTEMDRIVE'])

wrong!
the result is incorrect if the current directory is different from the
root.

>>> os.chdir("c:\\winxp")
>>> os.path.abspath(os.environ['SYSTEMDRIVE'])
'c:\\winxp'

if you really want it with backslash at the end, why not just add it

    os.environ['SYSTEMDRIVE'] + '\\'

is it too simple?!




More information about the Python-list mailing list