Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
Arushi

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')

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.