Python Platform – Get processor name

In this post we will be creating a Python script which will retrieve the name of the processor for the local machine, to do this we will be using the ‘platform’ library which gives access to the underlying platform’s identifying data.

The snippet of Python code below uses the ‘platform’ library to retrieve the name of the machines processor. The result is then print to output. Note that If the value of the processor can not be determined, the library will return an empty string. Also some platforms may not share this information.

import platform

processor = platform.processor()

print("Processor:", processor)

An example of what the above would return as output can be seen below.

Processor: AMD64 Family 23 Model 17 Stepping 0, AuthenticAMD
>>> 

Take a look at some of our other content around the Python programming language by clicking here.

Leave a Reply