Python 获取电脑内存型号代码 - 简洁实用
以下是 Python 获取内存型号的代码:
import wmi
# 获取 Win32_PhysicalMemory 类的实例
c = wmi.WMI()
mem_items = c.Win32_PhysicalMemory()
# 遍历内存条并输出型号
for mem in mem_items:
print(mem.Caption)
该代码使用了 Windows Management Instrumentation (WMI) 来获取 'Win32_PhysicalMemory' 类的实例,然后遍历内存条并输出型号。请注意,此代码仅适用于运行 Windows 操作系统的计算机。
AI 优化版
原文地址:https://www.cveoy.top/t/topic/nLfV 著作权归作者所有。请勿转载和采集!