Python3查看计算机系统、硬件信息

computer_info是一个Python库,专用于简洁地获取系统和硬件信息,如硬盘大小、BIOS版本等。使用pipinstallcomputer_info进行安装,适用于Python3.4到3.10版本。库中的函数命名清晰,如硬件相关函数以hardware开头,便于理解和使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Python3库教程:你还在为python查看计算机信息发愁吗?

你还在为python查看计算机信息发愁吗?你还在乱找库?或是使用一堆杂乱的代码只为查看主板编号?那,今天这个文章就彻底解决这个问题!

computer_info

computer_info专门用于查看系统信息,使用底层接口直接查询,快速便捷。使用pip install computer_info即可快速安装。该库原生版本:3.8,兼容:3.4~3.10。使用MPL2.0许可。

使用方法:

>>> import computer_info
>>> print(computer_info.hardware_disk_size())
{'C:': 255999, 'D:': 230108}

更多使用方法,请使用print(help("computer_info"))

>>> import computer_info
>>> help("computer_info")

Help on package computer_info:

NAME
computer_info - This package is used to view system and hardware information. 这个包用于查看系统及硬件信息。

DESCRIPTION
It uses the wmi library in order to view some hardware information. 它使用wmi库以查看一些硬件信息。
An example, if you want to use it to view the MAC address, you can code it like this: 例如,如果你想用它来查看MAC地址,你可以这样编码:

import computer_info                                                                       
print(computer_info.net_mac())                                           


I don’t believe I need to write a separate description to point out what the functions do, because the function names are clearly written, a

nd then the system automatically lists all the functions below. 我相信我无需编写一个另外的说明来指出函数们的作用,因为函数名称写得很清楚,然后系会在下面自动列出所有的函数。
The names of all system-related functions start with system, the names of network-related functions start with net, and the names of hardwar
e-related functions start with hardware. Only one function starts with computer. 所有与系统相关的函数的名称都以system开头,网络相关的函数的名称 以net开头,硬件相关函数的名称以hardware开头。只有一个函数以computer开头
This library is very useful, it is small, convenient and easy to call. You can use and combine these functions as many times as you want to get the most out of them. 这个库十分的好用,它小巧便捷,且调用方便。您可以随意地使用、组合这些函数以发挥您想要的最大效果。
Please forgive me if you can’t read the English in this description. I do not know English, this is just a machine translation. 如果你看不懂篇描述中的英语,请原谅我。我不懂英语,这只是机器翻译。 https://www.deepl.com/translator#zh/en/

PACKAGE CONTENTS

FUNCTIONS
computer_name()

hardware_bios_origin()

hardware_bios_release_date()                                                                                                               

hardware_bios_serial_number()

hardware_bios_version()

hardware_board_serial_number()                                                                                                             

hardware_cpu_name()

hardware_cpu_serial_number()

hardware_disk_free_space()                                                                                                                 
                                                                                                                                           
hardware_disk_serial_number()                                                                                                              

hardware_disk_size()

hardware_memory_capacity()

hareware_bios_info()    

快来使用吧!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值