Pythonは、ホスト情報を取得します

モジュール:プラットフォーム

platform.platform()

役割:オペレーティングシステム名とバージョン番号を取得します

使用法:

    >>>プリント(platform.platform())

    Windowsの-10-10.0.17134-SP0

    >>>プリント(platform.platform())

    Linuxの-3.10.0-693.el7.x86_64-x86_64版 - と - CentOSの - 1708年7月4日コア

platform.version()

役割:オペレーティングシステムのバージョン番号を取得します

使用法:

    >>>プリント(platform.version())

    10.0.17134

    >>>プリント(platform.version())

    #1 SMP火8月22日夜9時09分27秒UTC 2017

platform.architecture()

役割:オペレーティングシステムの桁を取得します

使用法:

    >>> platform.architecture()

    ( '64'、 'WindowsPE')

    >>> platform.architecture()

    (64ビット版、「ELF)

platform.processor()

役割:コンピュータプロセッサに関する情報を取得します

使用法:

    >>>プリント(platform.processor())

    Intel64ファミリ6モデル142ステッピング9、GenuineIntel

    >>>プリント(platform.processor())

    x86_64版

platform.system()

役割:オペレーティングシステムを取得します

使用法:

     >>>プリント(platform.system())

    ウィンドウズ

    >>>プリント(platform.system())

    Linuxの

platform.python_version()

役割:ローカルPythonのバージョン番号へのアクセス

使用法:

    >>>プリント(platform.python_version())

    3.6.5rc1

    >>>プリント(platform.python_version())

    3.5.7

公開された62元の記事 ウォン称賛16 ビュー10000 +

おすすめ

転載: blog.csdn.net/qq_41674452/article/details/103992482