Skip to content

Instantly share code, notes, and snippets.

@git2samus
Created August 11, 2015 21:10
Show Gist options
  • Save git2samus/44947109cd1b847f72f3 to your computer and use it in GitHub Desktop.
Save git2samus/44947109cd1b847f72f3 to your computer and use it in GitHub Desktop.
Frases Sinergia
#!/usr/bin/env python
import sys, random
if __name__ == '__main__':
if len(sys.argv) < 2:
print "ERROR: Se debe pasar la ruta del archivo de frases como parametro"
else:
with open(sys.argv[1]) as f:
frases = [text.strip() for text in f.read().split('\n') if text.strip()]
random.shuffle(frases)
print 'Presione Enter para recibir una frase o Ctrl-C para terminar'
print
try:
while True:
raw_input()
print frases.pop()
except KeyboardInterrupt:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment