get process id...

Fredrik Lundh fredrik at pythonware.com
Thu Sep 21 04:05:32 EDT 2006


billie wrote:

>> under linux, do:
 >
>>   import os
>>   os.getpid()
> 
> Under Windows:
 >
> import ctypes
> ctypes.windll.kernel32.GetCurrentProcessId()

getpid() works just fine on Windows too:

 >>> import ctypes
 >>> ctypes.windll.kernel32.GetCurrentProcessId()
1916
 >>> import os
 >>> os.getpid()
1916

</F>




More information about the Python-list mailing list