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'
  • 相关阅读:
    JS截取字符串常用方法详细整理
    学习网址
    MySQL获取指定长度的字符串的函数left(s,n)和right(s,n)
    MySQL中exists与in的使用
    MySQL DATE_FORMAT() 函数
    MySql 中 case when then else end 的用法
    SQL.Mysql中Cast()函数的用法
    MySql中concat函数的用法(链接字符串)
    TZOJ 3711 浪漫自习(最大流)
    TZOJ 1321 Girls and Boys(匈牙利最大独立集)
  • 原文地址:https://www.cnblogs.com/blitheG/p/8399554.html
Copyright © 2011-2022 走看看