-1

I am making a python program which would act as windows cmd, but I need a code which will display Windows's version. [Highlighted one]

Hint

How to make it?

1
  • It must display '10.0.10586' only! Commented Jul 9, 2019 at 12:31

3 Answers 3

1
import sys

ver = sys.getwindowsversion()
print("{}.{}.{}".format(ver.major, ver.minor, ver.build))

Output : 10.0.18362

Sign up to request clarification or add additional context in comments.

1 Comment

Good work! Just what I needed!
1
import platform
platform.version()

My output was '10.0.17134'

2 Comments

I displays Windows-10-10.0.10586-SP0, not 10.0.10586!
Otherwise good.
0

You can try this:

import os
os.system('ver')

1 Comment

I displays just like Command Prompt's first line of banner: Microsoft Windows [Version 10.0.10586]. But nice work!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.