连接到套接字
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: '.'
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')
I'm trying to connect to a proxy to see if its alive or dead, but I keep getting this error..
port = int(args[2])
ValueError: invalid literal for int() with base 10: '.'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你给你的代码提供了什么论据?
ValueError
告诉您您正在尝试将句点 (.
) 转换为整数,这是没有意义的。什么是args?What arguments are you giving your code? The
ValueError
is telling you that you're trying to convert a period (.
) to an integer, which makes no sense. What isargs
?