if len(p.cmdline())>=2: process_info = str(p.cmdline()[1]) result = process_info.find(name) if result != -1: pid = process_list[i] break print(pid) return pid def main(argv): name = argv[1] #print(name) get_pid(name) if __name__ == "__main__": main(sys.argv) ...
Find the pid of a process by name