python标准库 platform模块
# -*- coding: utf-8 -*-
# python:2.x
__author__ = 'Administrator'
#platform
#作用:检查底层平台硬件,操作系统和解释器版本信息等
#版本:2.3及之后
#其他:输出与系统相关信息
import platform
#解释器
#4个函数可以获取当前python解释器有关信息
"""
python_version()
python_version_tuple()
返回不同形式解释器版本,包括主版本,次版本,补丁级组件
python_compiler()报告构造解释器编译器
python_build()给解释器构建版本串
"""
print 'version:',platform.python_version()
print 'version tuple:',platform.python_version_tuple()
print 'compiler:',platform.python_compiler()
print 'build:',platform.python_build()
#平台
#platform()函数会返回一个字符串,其中包括一个通用平台标识符,这个函数接受2个可选布尔参数
#aliased为True,返回值中的名会从一个正式名转换为更常用格式,如果terse为true,返回一个最小值,即去除某些部分,而不是返回完整串
print 'normal:',platform.platform()
print 'aliased:',platform.platform(aliased=True)
print 'terse:',platform.platform(terse=True)
#操作系统和硬件信息
#uname()返回一个元组
print 'unname:',platform.uname()
print'system:',platform.system()#系统名
print 'node:',platform.node()#服务器主机名,还是完全限定名
print 'release:',platform.release()#操作系统发行号
print 'version:',platform.version()#更详细系统版本信息
print 'machine:',platform.machine()#硬件类型标识符
print 'processor:',platform.processor()#处理器实际标识符
#可执行程序体结构
#architecture()查看程序体系结构信息,第一参数是可执行程序路径(默认是sys.executable,即python解释器),返回一个元组,包含位体系结构和使用链接格式
print 'interpreter:',platform.architecture()
print u'python解释器路径: ',platform.architecture(r'/bin/ls')
#官方文档:https://docs.python.org/2.7/library/platform.html?highlight=platform#platform
python标准库 platform模块的更多相关文章
- [python标准库]Pickle模块
Pickle-------python对象序列化 本文主要阐述以下几点: 1.pickle模块简介 2.pickle模块提供的方法 3.注意事项 4.实例解析 1.pickle模块简介 The pic ...
- Python 标准库 ConfigParser 模块 的使用
Python 标准库 ConfigParser 模块 的使用 demo #!/usr/bin/env python # coding=utf-8 import ConfigParser import ...
- Python标准库——collections模块的Counter类
1.collections模块 collections模块自Python 2.4版本开始被引入,包含了dict.set.list.tuple以外的一些特殊的容器类型,分别是: OrderedDict类 ...
- [python标准库]XML模块
1.什么是XML XML是可扩展标记语言(Extensible Markup Language)的缩写,其中的 标记(markup)是关键部分.您可以创建内容,然后使用限定标记标记它,从而使每个单词. ...
- 【python】Python标准库defaultdict模块
来源:http://www.ynpxrz.com/n1031711c2023.aspx Python标准库中collections对集合类型的数据结构进行了很多拓展操作,这些操作在我们使用集合的时候会 ...
- Python标准库--os模块
这个模块包含普遍的操作系统功能.如果你希望你的程序能够与平台无关的话,这个模块是尤为重要的.即它允许一个程序在编写后不需要任何改动,也不会发生任何问题,就可以在Linux和Windows下运行.一个例 ...
- python标准库 bisect模块
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #bisect #作用:维护有序列表,而不必在每次向列表增加一个元素 ...
- python标准库 sysconfig模块
# -*- coding: utf-8 -*-# python:2.x__author__ = 'Administrator'import sysconfig#sysconfig:解释器编译时配置#作 ...
- Python——标准库 Sys模块
---------------------------------------------------------------------------------------------------- ...
随机推荐
- Opencv 简单的图片显示
#include <opencv\cv.h> #include <opencv\highgui.h> #include <opencv\cxcore.h> int ...
- HDOJ 1316 How Many Fibs?
JAVA大数.... How Many Fibs? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Jav ...
- Android BLE开发之Android手机与BLE终端通信
本文来自http://blog.csdn.net/hellogv/ ,引用必须注明出处! 近期穿戴设备发展得非常火.把相关技术也带旺了,当中一项是BLE(Bluetooth Low Energy).B ...
- [Regular Expressions] Find Plain Text Patterns
The simplest use of Regular Expressions is to find a plain text pattern. In this lesson we'll look a ...
- unbantu相关笔记
很多项目使用的系统是centos或者redhat,最近有一个项目使用的系统竟然是阿里云unbantu,不知道他们负责人怎么想的,明明有centos,非要用unbantu.抱怨到此,unbantu的学习 ...
- delete 用法
1.对象属性的删除 function fun(){ this.name = 'mm'; } var obj = new fun(); console.log(obj.name);//mm delete ...
- .net 开发定时执行的windows服务
环境:win7+vs2010+Oracle11g+office2010(64位操作系统) 需求:开发定时执行的windows服务从数据库中查询数据下载到指定地址Excel中 一.添加新建项目——win ...
- Shell脚本中单引号(‘)和双引号(“)的使用区别[转载]
shell可以识别4种不同类型的引字符号: 单引号字符' 双引号字符" 反斜杠字符\ 反引号字符` 1. 单引号 ( '' ) # grep Susan phonebook Susan Go ...
- unique &unique_copy
unique (ForwardIterator first, ForwardIterator last); unique (ForwardIterator first, ForwardIterat ...
- trim()方法去除字符串首尾空格
trim()方法去除字符串首尾空格 1.原生js Function trimStr(str){ Return str.r ...