zoukankan      html  css  js  c++  java
  • python之platform模块

    该模块用来访问平台相关属性。

    常见属性和方法

    平台架构

    platform.machine()

    返回平台架构。若无法确定,则返回空字符串。

    1
    2
    3
    4
    5
    >>> platform.machine()
    'AMD64'
     
    >>> platform.machine()
    'x86_64'

    网络名称(主机名)

    platform.node()

    返回计算机的网络名称(可能未被完全限定!)。如果无法确定该值,则返回空字符串。

    1
    2
    3
    4
    5
    6
    7
    #windows
    >>> platform.node()
    'office'
     
    #linux
    >>> platform.node()
    'abcxx'

    系统版本

    platform.platform(aliased = 0,terse = 0)

    如果aliased为True,则该函数将使用不同平台的别名来报告与其常用名称不同的系统名称,例如SunOS将被报告为Solaris。 system_alias()函数用于实现。
    将terse设置为True会导致该功能仅返回识别平台所需的绝对最小信息。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    >>> platform.platform()
    'Windows-8.1-6.3.9600-SP0'
    >>> platform.platform(aliased=True)
    'Windows-8.1-6.3.9600-SP0'
    >>> platform.platform(aliased=True,terse=True)
    'Windows-8.1'
    >>> platform.platform(aliased=True,terse=False)
    'Windows-8.1-6.3.9600-SP0'
     
    #linux
    >>> platform.platform()
    'Linux-2.6.32-642.13.1.el6.x86_64-x86_64-with-centos-6.8-Final'

     

    处理器名称

    platform.processor()

    返回处理器名称。

    1
    2
    3
    4
    5
    6
    >>> platform.processor()
    'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel'
     
    #linux
    >>> platform.processor()
    'x86_64'

    系统名称

    platform.system()

    返回系统/操作系统名称,例如“Linux”,“Windows”或“Java”。如果无法确定该值,则返回空字符串。

    1
    2
    3
    4
    5
    6
    >>> platform.system()
    'Windows'
     
    #linux
    >>> platform.system()
    'Linux'
  • 相关阅读:
    BZOJ 2260: 商店购物
    BZOJ 4349: 最小树形图
    BZOJ 1115: [POI2009]石子游戏Kam
    BZOJ 1413: [ZJOI2009]取石子游戏
    BZOJ 2275: [Coci2010]HRPA
    BZOJ 4730: Alice和Bob又在玩游戏
    BZOJ 1455: 罗马游戏
    BZOJ 3509: [CodeChef] COUNTARI
    BZOJ 1513: [POI2006]Tet-Tetris 3D
    #大数加减乘除#校赛D题solve
  • 原文地址:https://www.cnblogs.com/ghl666/p/12170305.html
Copyright © 2011-2022 走看看