telnet

Chris Liechti cliechti at gmx.net
Tue Apr 30 19:31:45 EDT 2002


"Billy Ng" <kwokng at earthlink.net> wrote in
news:5cFz8.127$ke3.35 at newsread2.prod.itd.earthlink.net: 
> tn = telnetlib.Telnet(host)
> tn.read_until("Please enter your id")
> tn.write(userid+"\r\n")
> 
> From here, tn will return either "Please enter your password" or
> "Wrong id, please enter your id again".  My question is how can I get
> the returning string before I do the next tn.write()

can't you go for a newline? often such messages print on a separate line, 
so you can just "readline" and use string methods to find out if it was 
positive.

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list