Last active
June 29, 2018 22:30
-
-
Save RednibCoding/65c3f3824439d8554b472164f1c99b4a to your computer and use it in GitHub Desktop.
Simple example of how to list all running processes with Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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