Last active
December 17, 2015 11:59
-
-
Save spratt/5606658 to your computer and use it in GitHub Desktop.
randomly select from lines of input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
import random | |
from sys import stdin, argv | |
words = [] | |
for line in stdin: | |
words.append(line.strip()) | |
n = int(argv[1]) | |
print(random.sample(words,n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment