模块:platform
platform.platform()
作用:获取操作系统名称及版本号
用法:
>>> print(platform.platform())
Windows-10-10.0.17134-SP0
>>> print(platform.platform())
Linux-3.10.0-693.el7.x86_64-x86_64-with-centos-7.4.1708-Core
platform.version()
作用:获取操作系统版本号
用法:
>>> print(platform.version())
10.0.17134
>>> print(platform.version())
#1 SMP Tue Aug 22 21:09:27 UTC 2017
platform.architecture()
作用:获取操作系统位数
用法:
>>> platform.architecture()
('64bit', 'WindowsPE')
>>> platform.architecture()
('64bit', 'ELF')
platform.processor()
作用:获取计算机处理器信息
用法:
>>> print(platform.processor())
Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
>>> print(platform.processor())
x86_64
platform.system()
作用:获取操作系统
用法:
>>> print(platform.system())
Windows
>>> print(platform.system())
Linux
platform.python_version()
作用:获取本机python版本号
用法:
>>> print(platform.python_version())
3.6.5rc1
>>> print(platform.python_version())
3.5.7