[Tutor] "Print" behaviour inside a loop?
Kent Johnson
kent37 at tds.net
Sun Jun 12 14:52:44 CEST 2005
Simon Gerber wrote:
> I got it working with
>
> while ip_addr == "":
> sys.stdout.writelines("...")
> sys.stdout.flush()
> time.sleep(0.5)
> ip_addr = get_addr()
> if ip_addr != '':
> ...
You should use sys.stdout.write(), not writelines(). writelines() expects a sequence of strings so what you wrote is roughly equivalent to
sys.stdout.write(".")
sys.stdout.write(".")
sys.stdout.write(".")
Kent
More information about the Tutor
mailing list