[Techtalk] Python question
Nils Philippsen
nils at wombat.dialup.fht-esslingen.de
Mon Apr 22 19:10:47 EST 2002
On Mon, 2002-04-22 at 17:46, Mandi wrote:
>
> ah. i missed that. thanks. :)
You might do with exceptions:
--- 8< ---
#!/usr/bin/python
password = "foobar"
count = 0
try:
while 1:
if(password!="unicorn") :
if count >= 3:
raise "threefails"
password=raw_input("Password : ")
count = count + 1
else :
raise "success"
except "threefails":
print "Failed three tries."
except "success":
print "Welcome in."
except:
# Handle some other exception
raise
--- >8 ---
Nils
--
Nils Philippsen / Berliner Straße 39 / D-71229 Leonberg //
+49.7152.209647
nils at wombat.dialup.fht-esslingen.de / nils at redhat.de /
nils at fht-esslingen.de
Ever noticed that common sense isn't really all that common?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
Url : http://linuxchix.org/pipermail/techtalk/attachments/20020422/adc20be1/attachment.pgp
More information about the Techtalk
mailing list