[Tutor] "Print" behaviour inside a loop?

Simon Gerber nequeo at gmail.com
Sun Jun 12 11:07:03 CEST 2005


>Just use sys.stdout.writelines(' ... ')
>
>Example:
>  >>> import sys
>  >>> sys.stdout.writelines ('... '); sys.stdout.writelines ('... ')
>  ... ... >>>
>  
>
Thank you for the suggestion Lee, but I'm afraid that doesn't work 
either. Same problems as described before. Max Noel hit the nail right 
on the head, though. 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 != '':
          ...

Script works like a charm now! Still rife with bugs and problems that 
would make it more or less useless for anyone except me - but a 
perfectly good, pptp config program already exists. I just made my own 
for education reasons.

Anyone curious can view the whole thing here:

http://members.optusnet.com.au/~sger/pytp

I'd welcome any constructive criticism. Also, I'm storing a lot of 
passwords in plain text files. I hope I got all the permissions stuff 
right, but again, if anyone happens to spot any obvious flaws please do 
share.

Regards,

-- 
"Come back to the workshop and dance cosmological models with me?"
 - Peer, "Permutation City", by Greg Egan. 

Simon Gerber
nequeo at gmail.com



More information about the Tutor mailing list