sys.stdout
tiissa
tiissa at free.fr
Fri Sep 9 05:19:33 EDT 2005
Sébastien Boisgérault a écrit :
> The sys.stdout stream behaves strangely in my
> Python2.4 shell:
>
> >>> import sys
> >>> sys.stdout.write("AAAA")
> >>> sys.stdout.write("BBBB\n")
> BBBB
> >>> sys.stdout.write("CCCC\nDDDD")
> CCCC
> >>> sys.stdout.flush()
> [...nothing...]
There are two things competing on your stdout: what you explicitely ask
the program to write and the prompt and echo of the interpreter.
Try this:
import sys, time
sys.stdout.write('aaa'); sys.stdout.flush(); time.sleep(2)
More information about the Python-list
mailing list