arg = data.split()
args = ''
for index,item in enumerate(arg) :
if index > 3:
if args == '':
args = item
else :
args += ' ' + item
if data.find('!check') != -1:
nick = data.split('!')[ 0 ].replace(':','')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ip = args[1]
port = int(args[2])
try:
s.connect((ip, port))
s.send('PRIVMSG ' + chan + " :" ' its alive' + '\r\n')
except socket.error:
s.send('PRIVMSG ' + chan + " :" ' its dead' + '\r\n')
我試圖連接到代理,看看它活着還是死了,但我不斷收到這個錯誤..連接到插座
port = int(args[2])
ValueError: invalid literal for int() with base 10: '.'
我們應該怎麼知道args [2]是什麼?調試器是你的朋友... – 2011-04-20 18:18:52