Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
communitycreator
platform
machine

What is the platform.machine() in Python?

Ravi

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The platform module in Python provides functions that access information of the underlying platform (the operating system).

The platform.machine() method is used to return the machine type of the underlying platform. For example, i386, i686, x86_64.

Method signature

machine()

Parameters

This method has no parameters.

Return value

The return type will be a machine type or an empty string.

Code

import platform
print("platform.machine() = %s" % (platform.machine()))
An example of a platform.machine() function in Python

Code explanation

  • Line 1: We import the platform module.
  • Line 3: We retrieve the machine type using the machine() method.

RELATED TAGS

python
communitycreator
platform
machine

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring