Here is the loop I am trying to use the map function on:
volume_ids = [1,2,3,4,5]
ip = '172.12.13.122'
for volume_id in volume_ids:
my_function(volume_id, ip=ip)
Is there a way I can do this? It would be trivial if it weren’t for the ip parameter, but I’m not sure how to deal with that.
Use
functools.partial():partial()creates a new callable, that’ll apply any arguments (including keyword arguments) to the wrapped function in addition to whatever is being passed to that new callable.