Created
June 26, 2014 10:35
-
-
Save fsword/36a9395d8c11a4a72361 to your computer and use it in GitHub Desktop.
python stdout auto flush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time,sys,os | |
# usage: | |
# ssh localhost 'python <this_file>' | |
def test(): | |
j = True | |
while j: | |
time.sleep(1) | |
print("Hello:"+str(j)) | |
print "Bye" | |
if __name__ == "__main__": | |
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) | |
test() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment