When I enter Task Manager I can see two sections. Apps(3) and Background processes(94). What I'm trying to do is get only those 3 that are not in the background.
My code:
for proc in psutil.process_iter():
print(proc.name())
But this gives me the names of all of those 90+ apps running in both foreground and background. How do I separate one from the other?
for p in psutil.process_iter(attrs=['name', 'username'])
and filter byusername
. – Wheelingname
field too. Read filtering-and-sorting-processes – Wheeling