How to check if OS is Vista in Python?

前端 未结 5 1190
眼角桃花
眼角桃花 2020-12-08 10:12

How, in the simplest possible way, distinguish between Windows XP and Windows Vista, using Python and pywin32 or wxPython?

Essentially, I need a function that called

5条回答
  •  萌比男神i
    2020-12-08 10:49

    An idea from http://www.brunningonline.net/simon/blog/archives/winGuiAuto.py.html might help, which can basically answer your question:

    win_version = {4: "NT", 5: "2K", 6: "XP"}[os.sys.getwindowsversion()[0]]
    print "win_version=", win_version
    

提交回复
热议问题