[BangPypers] "continue" in "try..except"

Nikunj Badjatya nikunjbadjatya at gmail.com
Sat Nov 19 16:01:28 CET 2011


Can someone throw some light on this please.



On Fri, Nov 18, 2011 at 7:23 PM, <Nikunj.Badjatya at emc.com> wrote:

> Hi ,
>
> Please look at the below code snippet:
>
> {{{
>
> if __name__ == "__main__":
>    try:
>        main()
>    except KeyboardInterrupt:
>        print("\nKeyboard interrupt from the user !!")
>        ret = input("Want to abort the installation ?[y/n]: ")
>        while True:
>            if ret == "y":
>                sys.exit(0)
>            elif ret == "n":
>                ## Want to continue the main() where it left of.
>            else:
>                ret = input("Please enter either y/n : ")
>                continue
>
> }}}
>
> In the "elif" block. I want to have a provision wherein "main()" would
> continue its execution where it left off.
> How can this be done.?
>
> Thanks
> Nikunj
>
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list