Persistent failure of 'break' statement ( novice )

John Machin sjmachin at lexicon.net
Sun Jun 14 02:51:44 EDT 2009


On Jun 14, 12:27 pm, pdlem... at earthlink.net wrote:
> On Sat, 13 Jun 2009 19:03:38 -0700 (PDT), John Machin
>
>
>
> <sjmac... at lexicon.net> wrote:
> >On Jun 14, 10:20 am, pdlem... at earthlink.net wrote:
>
> >> Now no error message, but it will go on forever despite repeatedly
> >> entering 0.  Have to get out with ctrl-c .    
>
> >>            Frusting: I'm missing something fundamental. Dave WB3DWE
>
> >After you hit the zero key, do you hit the Enter key?
>
[snip]
>
> John : Hitting Enter solved it.  Thanks so much.  I was treating
> input() as getch() or getche() .               Dave WB3DWE


Here's a tip: when all else fails, read the manual. In this case:

http://docs.python.org/3.0/library/functions.html#input

"""The function then reads a line from input, converts it to a string
(stripping a trailing newline)"""

If you are desperate for getch() and getche(), see here:

http://docs.python.org/3.0/library/msvcrt.html?highlight=msvcrt#console-i-o

HTH,
John






More information about the Python-list mailing list