There is the following code, how to display all processes in it with one line and remove from each .exe?
import psutil
for proc in psutil.process_iter():
name = proc.name()
print(name)
to get it
chrome, opera, svhost, ...
To get them in one line, use sep
parameter in print
function:
import psutil
enlisted = [proc.name() for proc in psutil.process_iter()]
print(*enlisted, sep = ' ')
Or there is end
parameter too.