The Python obtain host information

Module: platform

platform.platform()

Role: to obtain the operating system name and version number

usage:

    >>> print(platform.platform())

    Windows-10-10.0.17134-SP0

    >>> print(platform.platform())

    Linux-3.10.0-693.el7.x86_64-x86_64-with-centos-7.4.1708-Core

platform.version()

Role: to obtain the operating system version number

usage:

    >>> print(platform.version())

    10.0.17134

    >>> print(platform.version())

    #1 SMP Tue Aug 22 21:09:27 UTC 2017

platform.architecture()

Role: to obtain the operating system-digit

usage:

    >>> platform.architecture()

    ('64bit', 'WindowsPE')

    >>> platform.architecture()

    (64bit, "ELF)

platform.processor()

Role: to obtain information on a computer processor

usage:

    >>> print(platform.processor())

    Intel64 Family 6 Model 142 Stepping 9, GenuineIntel

    >>> print(platform.processor())

    x86_64

platform.system()

Role: to obtain the operating system

usage:

     >>> print(platform.system())

    Windows

    >>> print(platform.system())

    Linux

platform.python_version()

Role: Access to the local python version number

usage:

    >>> print(platform.python_version())

    3.6.5rc1

    >>> print(platform.python_version())

    3.5.7

Published 62 original articles · won praise 16 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_41674452/article/details/103992482