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')

 

相关文章:

  • 2022-02-06
  • 2021-11-24
  • 2021-07-17
  • 2021-08-19
  • 2021-09-01
  • 2021-12-15
  • 2021-08-23
  • 2021-11-27
猜你喜欢
  • 2021-08-11
  • 2021-09-21
  • 2021-05-23
  • 2021-06-08
  • 2021-12-05
相关资源
相似解决方案