Skip to content

Instantly share code, notes, and snippets.

@RednibCoding
Last active June 29, 2018 22:30
Show Gist options
  • Save RednibCoding/65c3f3824439d8554b472164f1c99b4a to your computer and use it in GitHub Desktop.
Save RednibCoding/65c3f3824439d8554b472164f1c99b4a to your computer and use it in GitHub Desktop.
Simple example of how to list all running processes with Python
import psutil
def listProcesses():
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs=['pid', 'name'])
except psutil.NoSuchProcess:
pass
else:
print(pinfo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment