How to find out operating system

Fredrik Lundh fredrik at
Thu Jun 27 18:50:32 CEST 2002

"A" wrote:

> What is the best way of  finding out the kind operating system?
> I can use but if the system is Windows I would like also
> know if the system is Windows98 or Windows ME or W2K or
> Windows XP.

some variation of

    import os
    if == "nt":
        version = os.popen("ver").read()
        if version.find("Windows 2000") >= 0:
            ... windows 2000
        elif ...
        version = os.uname()
        version = version[0], version[1]

might do the trick.

or use the PythonWin extensions (see lawrence's post)


More information about the Python-list mailing list