Select 50 items from list at random
Select 50 items from list at random Question: I have a function which reads a list of items from a file. How can I select only 50 items from the list randomly to write to another file? def randomizer(input, output=’random.txt’): query = open(input).read().split() out_file = open(output, ‘w’) random.shuffle(query) for item in query: out_file.write(item + ‘n’) …