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

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

    常见属性和方法

    平台架构

    platform.machine()

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

    >>> platform.machine()
    'AMD64'
    
    >>> platform.machine()
    'x86_64'
    

    网络名称(主机名)

    platform.node()

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

    #windows
    >>> platform.node()
    'office'
    
    #linux
    >>> platform.node()
    'abcxx'
    

     

    系统版本

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

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

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

    返回处理器名称。

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

     

    系统名称

    platform.system()

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

    >>> platform.system()
    'Windows'
    
    #linux
    >>> platform.system()
    'Linux'
    

     

  • 相关阅读:
    Girls and Boys
    妹子图.py
    requests的常用的方法和bs4的常用的方法:
    爬天极网线程池和进程池.py
    爬天极网多线程.py
    爬天极网多线程.py
    java实现遍历树形菜单方法——service层
    java实现遍历树形菜单方法——Dao层
    java实现遍历树形菜单方法——Dao层
    java实现遍历树形菜单方法——映射文件VoteTree.hbm.xml
  • 原文地址:https://www.cnblogs.com/leomei91/p/7680954.html
Copyright © 2011-2022 走看看