In [1]: Host = '1.1.1.1'
In [2]: username = ‘abc’ #用户名
In [3]: password = 'abc’ #密码
In [4]: superpass = 'abc' #超级密码
In [6]: import telnetlib
In [7]: tn = telnetlib.Telnet(Host) #连接交换机
In [8]: tn.read_until('Username:') #一直读到“Username:”
Out[8]: "\r\n******************************************************************************\r\n* Copyright (c) 2004-2012 Hangzhou H3C Tech. Co., Ltd. All rights reserved. *\r\n* Without the owner's prior written consent, *\r\n* no decompiling or reverse-engineering shall be allowed. *\r\n*******************************