[Tutor] new print statement + time module
Alan Gauld
alan.gauld at btinternet.com
Sat Feb 28 18:25:31 CET 2009
"George Wahid" <geoterium at gmail.com> wrote
> Thanks for the answers. I didn't have this problem with python 2.5.
> I
> know I can use stdout instead, but I want to know what I'm doing
> wrong.
You aren't doing anything wrong. The print function writes to
sys.stdout.
sys.stdout is a buffered file which means it doesn''t write to its
output
immediately but waits until enough data is in its buffer to make it
worthwhile - or until explicitly told to flush itself.
Because you are trying to write only one character at a time it's not
enough to make stdout write so you need to explicitly flush() it.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/
More information about the Tutor
mailing list