Get OS name

rbt rbt at athop1.ath.vt.edu
Fri Apr 15 09:56:06 EDT 2005


codecraig wrote:
> How can I get the OS Name, such as "Windows XP Pro".  I know I can do
> 
> sys.getwindowsversion but that doesnt return a nice Windows XP Pro
> string.
> 
> and os.name gives "nt"
> 
> thanks.
> 

Read the docs... sys.getwindowsversion() should do the trick. AFAIK, 
there is no way to differentiate between XP Home and Pro unless you 
attempt to call an executable that's only available on Pro... such as 
"systeminfo". If that call fails, it's reasonably safe to assume that 
you're on a XP Home machine... especially if getwindowsversion() 
produces a major of 5 and a minor of 1

As everyone knows that XP is really just NT 5.1 ;)



More information about the Python-list mailing list