Loop exception catching

Ivan Shevanski darkpaladin79 at gmail.com
Tue Jan 24 17:03:35 EST 2006


On 1/23/06, Aldo Cortesi <aldo at nullcube.com> wrote:
>
>
> Well, leaving aside the merits of using "input" (which should be avoided
> at all
> costs), here's one way to do what you want:
>
> while 1:
>     try:
>         x = input("> ")
>         break
>     except SyntaxError:
>         print "explain the problem here"
>
>
>
>
> Cheers,
>
>
>
> Aldo


Thanks, that seems to work fine.  But about your other comment. . .

>Well, leaving aside the merits of using "input" (which should be avoided at
all
>costs)

What do you mean?




--



-Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060124/7faabc87/attachment.html>


More information about the Python-list mailing list