python中的platform模块

 platform模块给我们提供了很多方法去获取操作系统的信息; import platform

print(platform.platform())# 获取操作系统名称和版本号:macOS-10.14.6-x86_64-i386-64bit
print(platform.system())# 获取操作系统:Darwin
print(platform.version()) # 获取计算机操作系统版本号:arwin Kernel Version 18.7.0: Mon Mar  8 22:11:48 PST 2021; root:xnu-1903.288.66~1/RELEASE_X86_64
print(platform.release()) #获取计算机操作系统的版本 18.7.0
print(platform.architecture()) #获取操作系统的位数 ('64bit', '')
print(platform.node())  # 计算机网络名称  yanzis-MacBook-Pro.local
print(platform.machine())  #计算机类型 x86_64
print(platform.processor()) #计算机处理器信息  i386
print(platform.uname())#获取以上信息的综合:uname_result(system='Darwin', node='yanzis-MacBook-Pro.local', release='18.7.0', version='Darwin Kernel Version 18.7.0: Mon Mar  8 22:11:48 PST 2021; root:xnu-1903.288.66~1/RELEASE_X86_64', machine='x86_64')
 

 

参考自:https://blog.csdn.net/holly_08/article/details/117960407

posted on 2023-01-02 09:47  一先生94  阅读(145)  评论(0编辑  收藏  举报

导航