好吧,我完全被一些超基本的python代码难住了。我觉得自己是个蠢货,不得不问这个问题,但这就是问题所在。我试图建立一个基本的端口扫描仪。我使用的代码,我绝对用过,并已工作。然而,每次我的代码运行时,我的空闲者都会抛出错误。你知道吗
我的代码段
##Request ip address and first port
web_request=urllib2.urlopen("http://" + ip + ":" + list(islice(port, 1))
##Define variable site as reading the webpage/ip address data
server=web_request.read()
##Show not open if length of site data is less than or equal to 1
if len(server)<='1':
print ip + ":" + list(islice(port, 1)) + " Not open"
等等等等等等
当它到达“server=web_请求读取()“IDLE给我一个无效的语法错误,说“server”是问题所在。我试着把服务器改成其他关键字(如IP、网站、站点),但没有用。知道为什么idle不接受我的代码吗?你知道吗
你的
web_request
有三个圆括号,只有两个右括号。你知道吗这几乎可以肯定是问题的起因,因为它认为
server
行是一个延续。你知道吗相关问题 更多 >
编程相关推荐