python 系统信息_Python获得操作系统信息

Python里里面有个platform模块,可以得到操作系统的相关信息

import platform

platform.machine()    # Returns the machine type, e.g. 'i386'

platform.node()    # Returns the computer's network name

platform.platform(aliased=0, terse=0)    # Returns a single string identifying the underlying platform

platform.processor()    # Returns the (true) processor name

platform.python_branch()    # Returns a string identifying the Python implementation branch.

platform.python_build()    # Returns a tuple (buildno, builddate) stating the Python build number and date as strings.

platform.python_compiler()    # Returns a string identifying the compiler used for compiling Python.

platform.python_version()    # Returns the Python version as string 'major.minor.patchlevel'

platform.release()    # Returns the system's release, e.g. '2.2.0' or 'NT'

platform.system()    # Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.

platform.uname()    # Fairly portable uname interface. Returns a tuple of strings (system,node,release,version,machine,processor) identifying the underlying platform.

platform.win32_ver(release='', version='', csd='', ptype='')    # Get additional version information from the Windows Registry and return a tuple (version,csd,ptype) referring to version number, CSD level and OS type (multi/single processor).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值