How do I find the type of system using Python?

How can we find the system type (i.e. 32-bit or 64-bit) using Python ...?

+3


source to share


3 answers


32-bit versions of Python (regardless of the architecture it is installed on):

>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')

      



64-bit Python versions:

>>> import platform
>>> platform.architecture()
('64bit', 'WindowsPE')

      

+1


source


The module platform

provides such information. Example:

>>> platform.architecture()
('32bit', 'ELF')

      



Additional information related to architecture is available in sys.platform

and sys.byteorder

.

+3


source


+2


source







All Articles