Skip to content

Instantly share code, notes, and snippets.

View AgustinLado's full-sized avatar

Agustín Lado AgustinLado

View GitHub Profile
@AgustinLado
AgustinLado / cowzen.py
Created June 29, 2015 15:31
Get a random line from the Zen of Python without a print (preferably for a colorful cow to chant!)
# Get a random line from the Zen of Python without a print (preferably for a colorful cow to chant!)
# Replace stdout by an anonymous class that returns nothing on write()
import sys
stdout = sys.stdout
sys.stdout = type('BlackHole', (), {'write': (lambda self, string: '')})()
# This import's output has now been supressed
import this