python3之platform模块

时间:2023-03-08 23:30:49
python3之platform模块

platform模块可以获取操作系统的相关信息。

>>> platform.system()   #获取系统名称
'Linux'
>>> platform.architecture() #获取系统位数
('64bit', 'ELF')
>>> platform.platform() #获取操作系统名称及版本号
'Linux-2.6.32-696.6.3.el6.x86_64-x86_64-with-centos-6.8-Final'
>>> platform.uname() #汇总信息
uname_result(system='Linux', node='zww', release='2.6.32-696.6.3.el6.x86_64', version='#1 SMP Wed Jul 12 14:17:22 UTC 2017', machine='x86_64', processor='x86_64')