[Tutor] Resuming one block of code continuously after exception in try/except construction
Ali Mammadov
assp1r1n3 at gmail.com
Sun Jul 6 23:00:38 CEST 2014
Hello fellow coders!
Today I encountered a small difficulty while working with files.As a common
pratice, I want my function to check user's input(in this case it's file
name) and re-ask it again and again(until correct) offering him two
choices: re-enter file name or close program.I've decided to use try/except
construction in this particular task. After a bit of googling, I still
didn't figure out how and if it's possible to re-run code in try part again
if exception raises. Should I use try/except or you would recommend me
another way(god bless, we have plenty of them! :))? What are the pros&cons
of this method?
BTW, I created a small gist located here
<https://gist.github.com/bca59570ea5fd365c672> which demonstrates my
problem.
Thank you in advance for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140706/e68017c9/attachment.html>
More information about the Tutor
mailing list