Get process id using python

How to get current process id using python on windows?

there is this function os.geteuid (), but its only work with linux / unix can someone say that this is Putin's way to get the current process identifier on windows.

+4
source share
1 answer

Do you really need a process id? Then the answer is:

>>> import os >>> os.getpid() 5328 

on Windows or Unix ( os.getpid documentation ).

os.geteuid() doesn't get the process id, which makes me wonder if you really ask another question ...?

+15
source

All Articles