- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Access to the underlying platform’s identifying data in Python
Functions in the platform module help us probe the underlying platform’s hardware, operating system, and interpreter version information.
architecture()
This function queries the given executable (defaults to the Python interpreter executable) for various architecture information.
>>> import platform >>> platform.architecture() ('64bit', '')
machine()
This function returns the machine type, e.g. 'i386'. An empty string is returned if the value cannot be determined.
>>> platform.machine() 'x86_64'
node()
This function returns the computer’s network name.
>>> platform.node() 'malhar-ubuntu'
platform(aliased=0, terse=0)
This function returns a single string identifying the underlying platform.
>>> platform.platform() 'Linux-4.13.0-46-generic-x86_64-with-debian-stretch-sid'
processor()
This function returns the (real) processor name.
>>> platform.processor() 'x86_64'
python_build()
This function returns a tuple (buildno, builddate)
>>> platform.python_build() ('default', 'Oct 13 2017 12:02:49')
python_compiler()
This function returns a string identifying the compiler used for compiling Python.
>>> platform.python_compiler() 'GCC 7.2.0'
python_implementation()
This function returns a string identifying the Python implementation. Possible return values are: ‘CPython’, ‘IronPython’, ‘Jython’, ‘PyPy’.
>>> platform.python_implementation() 'CPython'
python_version()
This function returns a string containing the Python version in the form 'major.minor.patchlevel'.
>>> platform.python_version() '3.6.3'
System()
This function returns the system/OS name
>>> platform.system() 'Linux'
uname()
Fairly portable uname interface. Returns a namedtuple() containing six attributes: system, node, release, version, machine, and processor.
>>> platform.uname() uname_result(system='Linux', node='malhar-ubuntu', release='4.13.0-46-generic', version='#51-Ubuntu SMP Tue Jun 12 12:36:29 UTC 2018', machine='x86_64', processor='x86_64')
- Related Articles
- Python Pandas - Return the dtype object of the underlying data
- Python Pandas - Return the number of bytes in the underlying Index data
- Python Pandas - Return the Number of elements in the underlying Index data
- Python Pandas - Return the Number of dimensions of the underlying data
- Python Pandas - Return a tuple of the shape of the underlying data
- Return the underlying data as a view of the masked array in Numpy
- Access to the Password Database in Python
- Access to the Group Database in Python
- Identifying Entity Relationships in DBMS
- Identifying False values in JavaScript
- Disable the underlying window when a popup is created in Python TKinter
- Access to the Shadow Password Database in Python
- How to access Python objects within objects in Python?
- Python Pandas - Create an Index based on an underlying Categorical
- System Authorization to use SAP HANA Smart Data Access
