how to get OS processes with python

3

I wanted to know if there is any way to make python able to know which processes are open in my OS (win 7 in my case)

ex:

[I have google open]

print "los procesos abiertos son:", procesos

the open processes are: google.exe

I hope to have explained myself well. Use python 2.7

    
asked by Luca Mendez 22.07.2018 в 03:25
source

1 answer

3

Python standard libraries do not provide such functionality, as the responses of indicate. List running processes on 64-bit Windows you can use 2 libraries:

  • wmi , windows only

    import wmi
    c = wmi.WMI ()
    
    for process in c.Win32_Process ():
        print(process.ProcessId, process.Name)
    
  • psutil , cross platform

    import psutil
    
    for p in psutil.process_iter():
        print(p, p.name(), p.pid)
    
answered by 22.07.2018 / 04:05
source