Python之获取平台和操作系统信息(platform模块)

#获取操作系统的一些信息:

import platform
platform.platform()        #获取操作系统名称及版本号,'Linux-3.13.0-46-generic-i686-with-Deepin-2014.2-trusty'
platform.system()          #获取操作系统名称,'Linux'
platform.version()         #获取操作系统版本号,'#76-Ubuntu SMP Thu Feb 26 18:52:49 UTC 2015'
platform.architecture()    #获取操作系统的位数,('32bit', 'ELF')
platform.machine()         #计算机类型,'i686'
platform.node()            #计算机的网络名称,'XF654'
platform.processor()       #计算机处理器信息,''i686'
platform.uname()           #包含上面所有的信息汇总,('Linux', 'XF654', '3.13.0-46-generic', '#76-Ubuntu SMP Thu Feb 26 18:52:49 UTC 2015', 'i686', 'i686')


#获取Python的一些信息:

import platform
platform.python_build()
platform.python_compiler()
platform.python_branch()
platform.python_implementation()
platform.python_revision()
platform.python_version()
platform.python_version_tuple()

猜你喜欢

转载自blog.csdn.net/WZ18810463869/article/details/81157337