Skip to content

Instantly share code, notes, and snippets.

@davesque
Created November 23, 2012 21:28
Show Gist options
  • Save davesque/4137387 to your computer and use it in GitHub Desktop.
Save davesque/4137387 to your computer and use it in GitHub Desktop.
Shuffle the lines of a file
#!/usr/bin/env python
import sys
import random
if __name__ == '__main__':
contents = sys.stdin.readlines()
random.shuffle(contents)
sys.stdout.write(''.join(contents))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment