主要利用python的wmi模块,提供非常多的信息。
import wmidef sys_version():
c = wmiWMI()
# *** 作系统版本,版本号,32位/64位
print('\nOS:')
sys = cWin32_OperatingSystem()[0]
print(sysCaption, sysBuildNumber, sysOSArchitecture)
# CPU类型 CPU内存
print('\nCPU:')
processor = cWin32_Processor()[0]
print(processorNamestrip())
Memory = cWin32_PhysicalMemory()[0]
print(int(MemoryCapacity)//1048576,'M')
# 硬盘名称,硬盘剩余空间,硬盘总大小
print('\nDISK:')
for disk in cWin32_LogicalDisk(DriveType=3):
print(diskCaption,'free:', int(diskFreeSpace)//1048576,'M\t', 'All:', int(diskSize)//1048576,'M')
# 获取MAC和IP地址
print('\nIP:')
for interface in cWin32_NetworkAdapterConfiguration(IPEnabled=1):
print("MAC: %s" % interfaceMACAddress)
for ip_address in interfaceIPAddress:
print("\tIP: %s" % ip_address)
# BIOS版本 生产厂家 释放日期
print('\nBIOS:')
bios = cWin32_BIOS()[0]
print(biosVersion)
print(biosManufacturer)
print(biosReleaseDate)
sys_version()
显示:
OS:Microsoft Windows 10 专业版 17134 64 位
CPU:
Intel(R) Core(TM) i5-7300HQ CPU @ 250GHz
8192 M
DISK:
C: free: 34165 M All: 120825 M
D: free: 265648 M All: 390777 M
E: free: 35669 M All: 204796 M
F: free: 5814 M All: 28163 M
G: free: 328650 M All: 329999 M
IP:
MAC: 00:50:56:C0:00:01
IP: 1921681821
IP: fe80::e0fb:efd8:ecb0:77f4
MAC: 00:50:56:C0:00:08
IP: 1921682131
IP: fe80::8da1:ce76:dae:bd48
MAC: 54:E1:AD:77:57:AB
IP: 192168199105
IP: fe80::aca8:4e6f:46e7:ef4a
BIOS:
LENOVO - 1
LENOVO
20170518000000000000+000
PLAYER_1 = '"C:\Program Files\Tencent\QQMusic\QQMusicexe"'
file = r"D:\tmp\trancecontrol-Emotionsmp3"
#方法1:
import subprocess
subprocessPopen(PLAYER_1 + " " + file); #非阻塞
#subprocessPopen(PLAYER_1 + " " + file)wati(); #阻塞
#方法2:阻塞
import os
#ossystem(PLAYER_1 + " " + file);
windows下有API
BOOL WINAPI ReadProcessMemory(
In HANDLE hProcess,
In LPCVOID lpBaseAddress,
Out LPVOID lpBuffer,
In SIZE_T nSize,
Out SIZE_T lpNumberOfBytesRead
);
以上就是关于利用python写一段读取电脑配置信息的程序全部的内容,包括:利用python写一段读取电脑配置信息的程序、python怎么调用exe程序、python 如何直接读取局域网内的其他机器的文件内容到当前程序内存中等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)