0

is there anyway to get model name of cpu using python ?

I have code which gives model name in Linux but i want model name in windows.

code:

with open('/proc/cpuinfo') as f:
    for line in f:
       # Ignore the blank line separating the information between
       # details about two processing units
       if line.strip():
           if line.rstrip('\n').startswith('model name'):
               model_name = line.rstrip('\n').split(':')[1]
               model=model_name
               model=model.strip()
               break
print(model)

please help me ?

2
  • both are same ? @Pavel Commented Dec 19, 2017 at 12:11
  • To get cpu model name, write a line of python code to execute this command: WMIC CSPRODUCT GET NAME Commented Dec 19, 2017 at 12:24

1 Answer 1

0

The platform.processor() function returns the processor name as a string.

>>> import platform
>>> platform.processor()
'Intel64 Family 6 Model 23 Stepping 6, GenuineIntel'
Sign up to request clarification or add additional context in comments.

3 Comments

(not the downvoter, but) If you're repeating an answer from an identical question, what you should instead do is flag the question as a duplicate so it can be closed, rather than answer it.
Sorry, new on this

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.