Finding out the OS distribution name
Gordon McMillan
gmcm at hypernet.com
Thu Oct 21 14:23:44 EDT 1999
[Marc-Andre]
> > > E.g. I'd like a function that returns 'Redhat6.1'/'SuSE6.2'
> > > or 'Win95'/'Win98'/'WinNT' or 'MacOS8'/'MacOS9' etc.
Windows NT:
os.environ['OS'] yields "Windows_NT"
os.environ['ComSpec'] yields the path to cmd.exe
In the registry, I find
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion
has items "CurrentVersion" ("4.0") and "CSDVersion"
("Service Pack 4")
The ver command gets you "Windows NT Version 4.0".
- Gordon
More information about the Python-list
mailing list