python platform模块

简介: 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'
目录
相关文章
|
3天前
|
Python
【Python进阶(五)】——模块搜索及工作目录
【Python进阶(五)】——模块搜索及工作目录
|
2天前
|
Python
Python使用typing模块(从Python 3.5开始)
【5月更文挑战第10天】Python使用typing模块(从Python 3.5开始)
12 3
|
3天前
|
Python
在Python中,利用`os模块`的`path.exists()`函数可判断文件是否存
【5月更文挑战第12天】在Python中,利用`os模块`的`path.exists()`函数可判断文件是否存在,该函数对路径进行检查,存在则返回True,不存在则返回False。示例代码展示了如何检查'example.txt'文件是否存在并相应打印消息。此外,`os.path.isfile()`用于确认路径是否为文件,仅当是文件时返回True,否则返回False,同样配以示例说明其用法。
23 2
|
3天前
|
Python Windows
python中的异常与模块
python中的异常与模块
12 1
|
3天前
|
JSON 数据格式 Python
Python标准库中包含了json模块,可以帮助你轻松处理JSON数据
【4月更文挑战第30天】Python的json模块简化了JSON数据与Python对象之间的转换。使用`json.dumps()`可将字典转为JSON字符串,如`{"name": "John", "age": 30, "city": "New York"}`,而`json.loads()`则能将JSON字符串转回字典。通过`json.load()`从文件读取JSON数据,`json.dump()`则用于将数据写入文件。
18 1
|
3天前
|
Python
Python实现压缩解压---tarfile模块详解
Python实现压缩解压---tarfile模块详解
|
3天前
|
Linux Python Windows
Python中time和datetime模块详解
Python中time和datetime模块详解
|
3天前
|
存储 Linux 数据安全/隐私保护
python的压缩模块zipfile详解
python的压缩模块zipfile详解
|
3天前
|
Linux Python Windows
python的os模块详细解读(二)
python的os模块详细解读(二)
|
3天前
|
移动开发 Linux Shell
python的os模块详细解读(一)
python的os模块详细解读(一)
python的os模块详细解读(一)