How to detect my OS info?
Gerhard Häring
gerhard.haering at opus-gmbh.net
Thu Feb 27 03:06:01 EST 2003
Peter Wu <peterwu at hotmail.com> wrote:
>>>>>> "Mark" == Mark McEahern <marklists at mceahern.com> writes:
>
> >> I use Windows and FreeBSD interchangeably. I want to write a
> >> .signature script that can detect my OS respectively.
> >>
> >> Under FreeBSD, I can fire 'uname -rs' to get the information I need
> >> and under Windows, I may need to leverage 'ver' to get the info.
> >>
> >> Is there a one-stop solution from Python? I mean I just write one
> >> python script and it can work both on Windows and FreeBSD? Thanks.
>
> Mark> Have you tried:
>
> Mark> import sys print sys.platform
>
> Under FreeBSD, it reports 'freebsd4';
> Under Win32, it reports 'win32'.
>
> How can I have more detailed information, such as version?
By using platform.py
(http://www.egenix.com/files/python/Introduction.html).
-- Gerhard
More information about the Python-list
mailing list