当前位置: 移动技术网 > IT编程>脚本编程>Python > python的platform模块的使用

python的platform模块的使用

2020年07月30日  | 移动技术网IT编程  | 我要评论

platform是用来获取操作系统的信息的模块,具体见文档

文档可能需要外网,不一定加载的出来,这里有现成的(ltsd)

[root@VM_0_9_centos ~]# python
Python 3.7.0 (default, Jun 28 2018, 13:15:42) 
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.uname()
uname_result(system='Linux', node='VM_0_9_centos', release='3.10.0-862.el7.x86_64', version='#1 SMP Fri Apr 20 16:44:24 UTC 2018', machine='x86_64', processor='x86_64')
>>> platform.uname()[1]
'VM_0_9_centos'
>>> platform.uname()[4]
'x86_64'
>>> platform.uname()[0]
'Linux'
>>> platform.machine()
'x86_64'
>>> platform.platform()
'Linux-3.10.0-862.el7.x86_64-x86_64-with-centos-7.5.1804-Core'
>>> platform.node()
'VM_0_9_centos'
>>> platform.python_compiler()
'GCC 7.2.0'
>>> platform.python_branch()
''
>>> platform.python_implementation()
'CPython'
>>> platform.python_revision()
''
>>> platform.python_version()
'3.7.0'
>>> platform.java_ver()
('', '', ('', '', ''), ('', '', ''))
>>> platform.win32_ver()
('', '', '', '')
>>> platform.dist()
__main__:1: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
('centos', '7.5.1804', 'Core')
>>> platform.libc_ver()
('glibc', '2.9')

 

本文地址:https://blog.csdn.net/zhou_438/article/details/107658599

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网