shuffle the lines of a large file

Richard Brodie R.Brodie at rl.ac.uk
Mon Mar 7 09:27:15 EST 2005


"Joerg Schuster" <joerg.schuster.REMOVETHIS at gmail.com> wrote in message
news:1110202592.006137.32560 at o13g2000cwo.googlegroups.com...

> I am looking for a method to "shuffle" the lines of a large file.

Of the top of my head: decorate, randomize, undecorate.
Prepend a suitable large random number or hash to each
line and then use sort. You could prepend new line numbers
instead but even storing the randomised indexes might use
too much memory.





More information about the Python-list mailing list