python之platform模块

^_^第三个模块从天而降喽!!

函数列表

  • platform.system() 获取操作系统类型,windows、linux等
  • platform.platform() 获取操作系统,Darwin-9.8.0-i386-32bit
  • platform.version() 获取系统版本信息 6.2.0
  • platform.mac_ver()
  • platform.win32_ver() ('post2008Server', '6.2.9200', '', u'Multiprocessor Free')

示例

>>> import platform
>>> platform.system()
'Linux'
>>> platform.platform()
'Linux-4.2.0-27-generic-x86_64-with-Ubuntu-14.04-trusty'
>>> platform.version()
'#32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC 2016'
>>> platform.mac_ver()
('', ('', '', ''), '')
>>> platform.win32_ver()
('', '', '', '')

sys.platform各平台的的返回值

column column
平台
Linux (2.x and 3.x) 'linux2'
Windows 'win32'
Windows/Cygwin 'cygwin'
Mac OS X 'darwin'
OS/2 'os2'
OS/2 EMX 'os2emx'
RiscOS 'riscos'
RiscOS 'riscos'
AtheOS 'atheos'

python之platform模块的更多相关文章

  1. python使用platform模块获取系统环境并去除换行符

    近来在porting一个网站,企图拿到这个网站的数据来做分析.为了支持多系统环境的正常运行.需要知道当前系统环境的是什么OS? 1.python内置platform库.可以很方便得到当前系统环境时什么 ...

  2. Python第十一天 异常处理 glob模块和shlex模块 打开外部程序和subprocess模块 subprocess类 Pipe管道 operator模块 sorted函数 os模块 hashlib模块 platform模块 csv模块

    Python第十一天    异常处理  glob模块和shlex模块    打开外部程序和subprocess模块  subprocess类  Pipe管道  operator模块   sorted函 ...

  3. python 模块之platform模块(基本了解)

    # -*- coding: cp936 -*-#python 27#xiaodeng#python 模块之platform模块(基本了解)#获取底层平台的识别数据 #知道该模块用途即可,需要使用时直接 ...

  4. Python platform 模块

    Python platform 模块 platform 模块用于查看当前操作系统的信息,来采集系统版本位数计算机类型名称内核等一系列信息. 使用方法: import platform # 获取操作系统 ...

  5. python之sys模块详解

    python之sys模块详解 sys模块功能多,我们这里介绍一些比较实用的功能,相信你会喜欢的,和我一起走进python的模块吧! sys模块的常见函数列表 sys.argv: 实现从程序外部向程序传 ...

  6. 学习PYTHON之路, DAY 6 - PYTHON 基础 6 (模块)

    一 安装,导入模块 安装: pip3 install 模块名称 导入: import module from module.xx.xx import xx from module.xx.xx impo ...

  7. Python学习——struct模块的pack、unpack示例

    he struct module includes functions for converting between strings of bytes and native Python data t ...

  8. python之sys模块

    38.python的sys模块: 用于提供对Python解释器相关的操作: 1 2 3 4 5 6 7 8 9 sys.argv           命令行参数List,第一个元素是程序本身路径 sy ...

  9. 【Python之路】第六篇--Python基础之模块

    模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才 ...

随机推荐

  1. Emeditor批量修改文件编码格式(UTF-8)

    采用宏的形式进行,直接在Emeidor导入宏即可使用: emeditor导入宏:[宏]->[自定义]->[新建]->找到EncodingChange.jsee文件即可. 链接:htt ...

  2. UVA1585

    #include<stdio.h> #include<string.h> int main(){ int n; ]; scanf("%d",&n); ...

  3. druid连接池获取不到连接的一种情况

    数据源一开始配置: jdbc.initialSize=1jdbc.minIdle=1jdbc.maxActive=5 程序运行一段时间后,执行查询抛如下异常: exception=org.mybati ...

  4. iframe用js设定自定义高度

    JS代码 function SetWinHeight(obj){ var win=obj; if (document.getElementById){ if (win && !wind ...

  5. Markdown与标记语言

    Markdown 是一种轻量级的「标记语言」,它的优点很多,目前也被越来越多的写作爱好者,撰稿者广泛使用.看到这里请不要被「标记」.「语言」所迷惑,Markdown 的语法十分简单.常用的标记符号也不 ...

  6. MySQL 新装数据库不能链接解决方法

    在my.ini的[mysqld]字段加入: skip-grant-tables 重启mysql服务,这时的mysql不需要密码即可登录数据库 然后进入mysql mysql>use mysql; ...

  7. linux 时间同步的2种方法

    转载自: http://blog.51yip.com/server/1474.html 由于硬件的原因,机器或多或少的根标准时间对不上,一个月的误差几秒到几分钟不等.对于服务器来说时间不准,会有很多麻 ...

  8. thinkphp修改和删除数据

    1.在控制器MainController里面写一个方法,调用Nation表中的数据. public function zhuyemian() { $n = D("Nation"); ...

  9. android 一些常用开源框架

    网络请求compile 'com.squareup.okhttp:okhttp:2.6.0'okhttp依赖compile 'com.squareup.okio:okio:1.6.0'json解析co ...

  10. css3 圆角

    -moz-border-radius: 15px; /* Gecko browsers */ -webkit-border-radius: 15px; /* Webkit browsers */ bo ...