可能有同学不知道. 顺便给自己做个笔记.>>> import os, csv
>>> fp = os.popen("wmic cpu list /format:csv")
>>> for i in csv.reader(fp):
... print i
...
[]
['Node', 'AddressWidth', 'Architecture', 'Availability', 'Caption', 'ConfigManagerErrorCode', 'ConfigManagerUserConfig', 'CpuStatus', 'CreationClassName', 'CurrentClockSpeed', 'CurrentVoltage', 'DataWidth', 'Description', 'DeviceID', 'ErrorCleared', 'ErrorDescription', 'ExtClock', 'Family', 'InstallDate', 'L2CacheSize', 'L2CacheSpeed', 'LastErrorCode', 'Level', 'LoadPercentage', 'Manufacturer', 'MaxClockSpeed', 'Name', 'OtherFamilyDescription', 'PNPDeviceID', 'PowerManagementCapabilities', 'PowerManagementSupported', 'ProcessorId', 'ProcessorType', 'Revision', 'Role', 'SocketDesignation', 'Status', 'StatusInfo', 'Stepping', 'SystemCreationClassName', 'SystemName', 'UniqueId', 'UpgradeMethod', 'Version', 'VoltageCaps']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU0', '', '', '333', '176', '', '4096', '2327', '', '6', '0', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU1', '', '', '333', '176', '', '4096', '2327', '', '6', '4', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU2', '', '', '333', '176', '', '4096', '2327', '', '6', '0', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU3', '', '', '333', '176', '', '4096', '2327', '', '6', '2', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
>>>
>>> fp = os.popen("wmic cpu list /format:csv")
>>> for i in csv.reader(fp):
... print i
...
[]
['Node', 'AddressWidth', 'Architecture', 'Availability', 'Caption', 'ConfigManagerErrorCode', 'ConfigManagerUserConfig', 'CpuStatus', 'CreationClassName', 'CurrentClockSpeed', 'CurrentVoltage', 'DataWidth', 'Description', 'DeviceID', 'ErrorCleared', 'ErrorDescription', 'ExtClock', 'Family', 'InstallDate', 'L2CacheSize', 'L2CacheSpeed', 'LastErrorCode', 'Level', 'LoadPercentage', 'Manufacturer', 'MaxClockSpeed', 'Name', 'OtherFamilyDescription', 'PNPDeviceID', 'PowerManagementCapabilities', 'PowerManagementSupported', 'ProcessorId', 'ProcessorType', 'Revision', 'Role', 'SocketDesignation', 'Status', 'StatusInfo', 'Stepping', 'SystemCreationClassName', 'SystemName', 'UniqueId', 'UpgradeMethod', 'Version', 'VoltageCaps']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU0', '', '', '333', '176', '', '4096', '2327', '', '6', '0', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU1', '', '', '333', '176', '', '4096', '2327', '', '6', '4', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU2', '', '', '333', '176', '', '4096', '2327', '', '6', '0', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
['MATH03', '32', '0', '3', 'x86 Family 6 Model 23 Stepping 10', '', '', '1', 'Win32_Processor', '2327', '21', '32', 'x86 Family 6 Model 23 Stepping 10', 'CPU3', '', '', '333', '176', '', '4096', '2327', '', '6', '2', 'GenuineIntel', '2327', 'Intel Pentium III Xeon \xb4\xa6\xc0\xed\xc6\xf7', '', '', '', 'FALSE', 'BFEBFBFF0001067A', '3', '5898', 'CPU', 'Socket 423', 'OK', '3', '10', 'Win32_ComputerSystem', 'MATH03', '', '9', '\xd0\xcd\xba\xc5 7\xa3\xac\xb2\xbd\xbd\xf8 10', '']
>>>