How to get the running process’ pid in Python?
Posted on In QAHow to get the running process’ pid in Python?
In Python, you can get the pid of the current process by
import os
os.getpid()
From the official doc:
os.getpid()
Return the current process id.
you can use os.popen(” pidof “).read() if u are in linux/ unix os