read_until problem under telnetlib

Steve Horsley steve.horsley at
Fri Jun 13 14:03:13 CEST 2003

david_martin at (dma2) wrote in message news:<b94c6ea6.0306110847.571d6690 at>...
> hi, i am having a problem that seems not to have been adressed yet on
> this list
> i work on thousands of cisco equipements, and as usual the cisco
> prompt is not consistent across their whole range of equipements and i
> need this kind of code

expect() takes a LIST of strings, not a single string.
Also, it returns a tuple. This should work:

    index, match, got = cnx.expect(['#', '(enable)'], 5)
    if index == 0:
        print "it's an IOS box"
    elif index == 1:
        print "it's a CatOS box"
        print "Urgh! Timeout."


More information about the Python-list mailing list