python try小例子

时间:2014-07-01 15:33:07   收藏:0   阅读:215

#!/usr/bin/python

import telnetlib

import socket

try:

        tn=telnetlib.Telnet(‘10.67.21.29‘,60000)

except socket.error, e:

        print e

        exit(1)

tn.set_debuglevel(1)

tn.write(‘quit‘+‘\n‘)

print ‘ok‘



socket.error为错误类型 e为对象

本文出自 “expect批量同步数据” 博客,请务必保留此出处http://4249964.blog.51cto.com/4239964/1432945

python try小例子,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!