On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: > > print(*__import__("random").sample(open("/usr/share/dict/words").read().spli > > t("\n"),4))
In article <68365e43-498f-4ad2-bac3-6a0293815...@googlegroups.com>, sprucebond...@gmail.com wrote: > import random as r > print(*r.sample(open("/usr/share/dict/words").readlines(),4)) > > Shaves off 6 characters. If you're willing to accept a sub-optimal random number generator: # Python-2, sorry import os print list(set(open('/usr/share/dict/words')))[os.getpid():][:4] I'll also point out that on my OSX box, I could have used /usr/share/dict/web2 and saved one more character :-) ¯
-- https://mail.python.org/mailman/listinfo/python-list