Monday, 26 August 2013

Retrieve 10 random lines from a file

Retrieve 10 random lines from a file

I have a text file which is 10k long and I need to build a function to
extract 10 random lines each time from this file. I already found how to
generate random numbers in Python with numpy and also how to open a file
but I don't know how to mix it all together. Please help.

No comments:

Post a Comment