I've written a script to be able to run all processes contained within it, but I'd like to be able to run only the desired processes.
I think I'm stumbling into a different use for lists than I've needed in the past, but I'm not quite sure how to go about it.
I've got four functions: foo1, foo2, foo3, and foo4. I'd like to be able to selectively run any of these functions within the python script itself using a specific number users insert using the input() function. A sample of code can be seen below.
ListAllVSs = requests.get('https://' + LMIP + '/access/listvs', verify=False, auth=MyCreds)
ListVSOutput = ListAllVSs.content.splitlines()
for Line in ListVSOutput:
if b"<Index>" in Line:
IndexLines.append(Line)
NumbersList = [int(re.search(br"\d+", Integer).group()) for Integer in IndexLines]
for Number in NumbersList:
VSIDAndValue = (
('vs', str(Number)),
)
requests.get('https://' + LMIP + '/access/delvs', params=VSIDAndValue, verify=False, auth=MyCreds)
So, this is isn't exactly tied to a single function.
For example, users should insert "1" to run foo1, "2" to run foo2, "3" to run foo3, "4" to run foo4, "5" to run foo1 and foo2, etc. To run all possible combinations of functions, there will be 15 total possible inputs and any number below 0 or above 15 should be deemed as invalid.
I'd like to use "0" to run all four processes, which I think is possible due to how Python numbers its list positions, but I'm alright with this being "15", if needed.
Thanks in advance!