I am trying to create a method in python that takes a 1-n number of parameters, calls the same method for each and returns the result. For example:
(Note that this is pseudo code, I just type these methods / syntax on the fly - new to python)
def get_pid(*params):
pidlist = []
for param in params:
pidlist.add(os.getpid(param))
return pidlist
Ideally, I would like to do something like
x, y = get_pid("process1", "process2")
Where can I add as many parameters as I want - and this method should be as "Putin" and compact as possible. I think there might be a better way than going through the parameters and adding to the list?
Any suggestions / tips?
source
share