Skip to content

Instantly share code, notes, and snippets.

@alanduan
Created October 15, 2013 08:00
Show Gist options
  • Save alanduan/6988109 to your computer and use it in GitHub Desktop.
Save alanduan/6988109 to your computer and use it in GitHub Desktop.
buffer disabled
class Unbuffered:
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)
import sys
sys.stdout=Unbuffered(sys.stdout)
print 'Hello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment