Python Platform – Check machine type

In this post we will be creating a Python script which will check and retrieve the local machine type, 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 check the local machine type. The result is then print to output. Note that If the value of the machine type can not be determined, the script returns an empty string.

import platform

machine = platform.machine()

print("Machine:", machine)

An example of what the above would return as output can be seen below. This information tells us which type of computer architecture that a computer system is built upon.

Machine: AMD64

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

Leave a Reply