Check whether Python shell is executing in 32bit or 64bit mode on OS
In this article, we are going to see how to check if the Python shell is executing in 32bit or 64bit mode.
The following Python script can be used to determine whether the Python shell is executing in 32bit or 64bit mode. The code was compiled successfully and it gave the result.
Method 1: Using Platform Packages
Here we are going to use platform packages to get the mode of or the os. architecture() methods from the platform packages return the mode of os.
Python3
import platform print (platform.architecture()) |
Output
('64bit', '')
Method 2: Using struct Packages
Struct package also helps to get the related mode of os.
Python3
import struct print (struct.calcsize( "P" ) * 8 ) |
Output
64
Contact Us