How to extract a particular attribute from instance of Win32_PnPEntity?
问题 def getPnpDeviceInfo(): c = wmi.WMI() wql = "SELECT * FROM Win32_PnPEntity WHERE Manufacturer != 'Microsoft' AND NOT PNPDeviceID LIKE 'ROOT\\%'" print ("All physical PNP devices") for J in c.query(wql): print(J) This function (the query) typically returns all physical PNP devices, here is an output sample : instance of Win32_PnPEntity { Caption = "ACPI Lid"; ClassGuid = "{4d36e97d-e325-11ce-bfc1-08002be10318}"; ConfigManagerErrorCode = 0; ConfigManagerUserConfig = FALSE; CreationClassName =