How to get the running process’ pid in Python?

How 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.
Answered by dtivl.

Leave a Reply

Your email address will not be published. Required fields are marked *