What is platform.architecture() in Python?
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 platformprint("platform.architecture() = " , platform.architecture())
Explanation
- Line 1: We import the
platformmodule. - Line 3: We retrieve the system’s architecture using the
architecture()method.