How to check if OS is Vista in Python?

前端 未结 5 1192
眼角桃花
眼角桃花 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条回答
  •  天命终不由人
    2020-12-08 10:47

    import platform
    if platform.release() == "Vista":
        # Do something.
    

    or

    import platform
    if "Vista" in platform.release():
        # Do something.
    

提交回复
热议问题