import sys
import time
start = time.time()
key = input('Type your key:')
x = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'1', '2', '3', '4', '5', '6', '7', '8', '9')
for x1 in x:
for x2 in x:
for x3 in x:
y = (x1+x2+x3)
print (y)
if y == key:
print('Founded')
exit()
done = time.time()
elapsed = done - start
print(elapsed)
代码不会停止使用exit(),程序必须完成所有停止的可能性。
如果您想退出循环并继续执行您的代码(可以通过将exit替换为]
break
您需要运行:
sys.exit("Optional Exiting Message")
代替:
exit()
您在Python空闲时使用exit()。
您也可以使用:
pass
或
# comment it, is it necessary to write code there?