请检查以下代码,
import sys
try:
seq=eval(raw_input("Enter seq number: "))
if seq <= 0 or seq >= 9999:
print "Sequence number not in range [0001-9999]"
sys.exit(1)
except:
print "!!! Sequence number not in range [0001-9999]"
sys.exit(1)
我给了一个字符串来eval raw_input
运行。
$> python test.py
Enter seq number: "12"
Sequence number not in range [0001-9999]
!!! Sequence number not in range [0001-9999]
为什么接到电话后也不退出exit
?