Using map() function with keyword arguments

前端 未结 5 1188
心在旅途
心在旅途 2020-11-28 06:29

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_fun         


        
5条回答
  •  感情败类
    2020-11-28 07:18

    This can be done easily with a list comprehension.

    volume_ids = [1,2,3,4,5]
    ip = '172.12.13.122'
    results = [my_function(i,ip=ip) for i in volume_ids]
    

提交回复
热议问题