Ich habe folgenden Code, und möchte die Ausgabe so, das ich nur die Inhalte von pid und Name angezeigt bekommen.
Code: Alles auswählen
import psutil
for proc in psutil.process_iter(attrs=['pid', 'name']):
print(proc.info)
Code: Alles auswählen
...
{'pid': 1500, 'name': 'svchost.exe'}
{'pid': 1508, 'name': 'svchost.exe'}
{'pid': 1520, 'name': 'svchost.exe'}
{'pid': 1668, 'name': 'svchost.exe'}
{'pid': 1704, 'name': 'svchost.exe'}
{'pid': 1732, 'name': 'svchost.exe'}
{'pid': 1744, 'name': 'svchost.exe'}
{'pid': 1792, 'name': 'WhatsApp.exe'}
{'pid': 1848, 'name': 'atiesrxx.exe'}
{'pid': 1868, 'name': 'svchost.exe'}
{'pid': 1944, 'name': 'svchost.exe'}
{'pid': 2032, 'name': 'igfxCUIService.exe'}
{'pid': 2076, 'name': 'RuntimeBroker.exe'}
{'pid': 2108, 'name': 'svchost.exe'}
{'pid': 2172, 'name': 'svchost.exe'}
{'pid': 2184, 'name': 'winwfpmonitor.exe'}
{'pid': 2192, 'name': 'svchost.exe'}
{'pid': 2232, 'name': 'svchost.exe'}
...
Auf jeden Fall riesen Dank!