Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
communitycreator

What is platform.architecture() 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 (operating system).

For different architectural information, the platform.architecture() method queries the specified executable (defaults to the Python interpreter binary). The return value is a tuple of size two where the first element indicates the bit architecture (the number of bits in the processor) and the second element indicates the linkage format used for the executable.

Method signature

architecture(executable=sys.executable, bits='', linkage='')

Parameters

  • executable: The executable to query.
  • bits: Represents the bit architecture.
  • linkage: Represents the linkage format.

Return value

A tuple containing the bit architecture and the linkage format of the executable.

Example

import platform
print("platform.architecture() = " , platform.architecture())
Using the "platform.architecture" method

Explanation

  • Line 1: We import the platform module.
  • Line 3: We retrieve the system’s architecture using the architecture() method.

RELATED TAGS

python
communitycreator

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