I use BeautifulSoup to get values and put into a list: for example
ids = ['123','234','345','494','484']
I now want to pick a random value from ids in a payload request such as:
'add':random.choice(ids)
When I run a loop I want that already taken value doesn't get picked up again. The values in ids can vary, there can be 0 values, but also 10.
I have tried following with no success:
from random import shuffle
mylist = pids
shuffle(mylist)
while mylist:
hey = mylist.pop()
print (hey)
Aucun commentaire:
Enregistrer un commentaire