Python sys.stdout.flush() doesn't work Python sys.stdout.flush() doesn't work python-3.x python-3.x

Python sys.stdout.flush() doesn't work


Found the problem

import sysimport timefor count in range(10) :   sys.stdout.write("\b%s" % count)   sys.stdout.flush()   time.sleep(.1)

Don't know why python is weird like this but apparently it accepted this. Your code should've worked fine but I guess python just didn't like you.


Python 2.7, 3.2, and 3.3 all don't allow keyword arguments in your write call. Is that the proper code? The print function of course allows the end keyword and shouldn't be confused with write. Write does not add a newline character.

Removing 'end' keyword argument and testing shows the code works fine.