zoukankan      html  css  js  c++  java
  • python

    转载自:https://www.cnblogs.com/leomei91/p/7680954.html

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

    常见属性和方法

     

    平台架构

    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'
  • 相关阅读:
    当扩展方法和类里定义的方法重名时,会优先调用类里自义的方法
    jquery.uploadify不支持MVC的Authorize
    .NET4中多线程并行方法Parallel.ForEach
    http://twitter.github.com/bootstrap/
    .NET 4.0中使用sqlite
    Extend Html.EditorFor MVC
    Custom Email Attribute在客户端不起作用原因
    使用webpack搭建vue环境
    新浪sae对storage的文档进行读写操作
    jquery+bootstrap插件
  • 原文地址:https://www.cnblogs.com/blitheG/p/8399554.html
Copyright © 2011-2022 走看看