python之platform模块
python之platform模块
^_^第三个模块从天而降喽!!
函数列表
platform.system()获取操作系统类型,windows、linux等platform.platform()获取操作系统,Darwin-9.8.0-i386-32bitplatform.version()获取系统版本信息 6.2.0platform.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模块的更多相关文章
- python使用platform模块获取系统环境并去除换行符
近来在porting一个网站,企图拿到这个网站的数据来做分析.为了支持多系统环境的正常运行.需要知道当前系统环境的是什么OS? 1.python内置platform库.可以很方便得到当前系统环境时什么 ...
- Python第十一天 异常处理 glob模块和shlex模块 打开外部程序和subprocess模块 subprocess类 Pipe管道 operator模块 sorted函数 os模块 hashlib模块 platform模块 csv模块
Python第十一天 异常处理 glob模块和shlex模块 打开外部程序和subprocess模块 subprocess类 Pipe管道 operator模块 sorted函 ...
- python 模块之platform模块(基本了解)
# -*- coding: cp936 -*-#python 27#xiaodeng#python 模块之platform模块(基本了解)#获取底层平台的识别数据 #知道该模块用途即可,需要使用时直接 ...
- Python platform 模块
Python platform 模块 platform 模块用于查看当前操作系统的信息,来采集系统版本位数计算机类型名称内核等一系列信息. 使用方法: import platform # 获取操作系统 ...
- python之sys模块详解
python之sys模块详解 sys模块功能多,我们这里介绍一些比较实用的功能,相信你会喜欢的,和我一起走进python的模块吧! sys模块的常见函数列表 sys.argv: 实现从程序外部向程序传 ...
- 学习PYTHON之路, DAY 6 - PYTHON 基础 6 (模块)
一 安装,导入模块 安装: pip3 install 模块名称 导入: import module from module.xx.xx import xx from module.xx.xx impo ...
- Python学习——struct模块的pack、unpack示例
he struct module includes functions for converting between strings of bytes and native Python data t ...
- python之sys模块
38.python的sys模块: 用于提供对Python解释器相关的操作: 1 2 3 4 5 6 7 8 9 sys.argv 命令行参数List,第一个元素是程序本身路径 sy ...
- 【Python之路】第六篇--Python基础之模块
模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才 ...
随机推荐
- 架构师养成记--6.单例和多线程、ThreadLocal
一.ThreadLocal 使用wait/notify方式实现的线程安全,性能将受到很大影响.解决方案是用空间换时间,不用锁也能实现线程安全. 来看一个小例子,在线程内的set.get就是thread ...
- SHELL编写NGINX自动部署脚本
1.功能描述 1. 安装支持包,从软件源下载自定义的NGINX包,创建NGINX用户和用户组. 2. 安装并初始化NGINX配置. 3. 运行NGINX并检测运行状态. 2.实现 源码如下: #!/b ...
- centos7的使用
在虚拟机vmware 中如果打算安装vmware tools增强工具的话! 可 以先在mnt目录下创建一个文件夹,mkdir /mnt/cdrom,然后通过mount /dev/cdrom /mnt/ ...
- MediaElement 的两种模式
MediaElement 是一个 UIElement,它受 布局系统 支持并可用作许多控件的内容.它也可用在可扩展应用程序标记语言 (XAML) 以及代码中.另一方面,MediaPlayer 用于 D ...
- ITShare
框架底层通过IBatis和XML实现ORM映射: 业务处理类似UI,通过Controller和JavaScript交互: 视图通过Castle与NVelocity实现,jquery.tmpl渲染: . ...
- boostrap 模态框
<div class="modal fade" id="myModal" tabindex="-1" role="dialo ...
- linux系统运维常用基本命令详解
1.ls 文件属性: -:普通文件 d:目录文件 b:块设备 c:字符设备文件 l:符号连接文件 p:命令管道 s:套接字文件 文件权限: 9位数字,每3位一组 文件硬链接次数 ...
- php二维数组相同id的数量相加
数组样式 $arr = array( array( , , , ), array( , , , ), array( , , , ), array( , , , ), ); 处理办法 $item=arr ...
- 如何修改geditor的配置文件 -好像geditor没有文本格式的配置文件? 要使用dconf-editor来配置- geditor自己配置编码格式
好像geditor没有文本格式的配置文件? 好像是通过一个程序, 叫 dconf-editor 来配置geditor的? 以前是通过gconf-editor来配置的, 但是gconf-editor的配 ...
- REDHAT一总复习1 记录systemd日志条目 rsyslogd配置记录日志指令
显示9:05:00 到9:15:00 之间在/home/student/systemdreview.txt 文件中记录所有systemd日志条目 # echo "journalctl --s ...