Python - injecting data into for loop -


i have following list:

users = [     "user1",     "user2",     "user3"     ] 

and have loop, loops through another list:

for item in ids:     myfunction(item, user) # ??? 

i'm not sure how make loop. want to is, each item loop goes through, should execute myfunction(item, user), user variable should user users list, , each item, user should not same (when gets end of users list, may come user1, , repeat loop).

it should execute this:

myfunction(item, "user1") myfunction(item, "user2") myfunction(item, "user3") 

how can achieve this?

thank you

for counter, item in enumerate(ids):     user = users[counter % len(users)]     myfunction(item, user) 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -