Skip to content

Instantly share code, notes, and snippets.

@larsyencken
Last active December 23, 2015 07:59
Show Gist options
  • Save larsyencken/6604856 to your computer and use it in GitHub Desktop.
Save larsyencken/6604856 to your computer and use it in GitHub Desktop.
Python: unbuffer stdout
import os
import sys
# replace stdout with an identical file descriptor of buffer size 0
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment