Get OS name
Fredrik Lundh
fredrik at pythonware.com
Fri Apr 15 11:18:35 EDT 2005
"codecraig" wrote:
> How can I get the OS Name, such as "Windows XP Pro"
>i guess i wanted the result in a nice string like Windows XP instead of
> 5.1
>
> i guess i'll have to convert it myself, thanks
your requirements keep changing. to get the OS name in a platform-
independent way, use the platform module:
> python
>>> import platform
>>> print platform.system(), platform.release()
Windows XP
$ python
>>> import platform
>>> print platform.system(), platform.release()
Linux 2.4.18-3
etc.
(tip: reading the "library reference" table of contents a couple of times is a great way
to learn about the contents of the standard library. http://docs.python.org/lib/lib.html )
</F>
More information about the Python-list
mailing list