Environment variables - Expand

Dips dipankarweb at yahoo.co.in
Mon May 12 07:14:10 EDT 2003


Hi All,

Is it possible to expand environment variable in Windows using
one-liner python command?

For instance, the following command doesn't expand %WINDIR%
automatically
file_name = '%WINDIR%\WIN.INI'
file = os.open(file,'r')

In actual 'file_name' is fed as command-line argument and so can
contain any environement variables.

_D




More information about the Python-list mailing list