Beeping the console

Jeffrey Barish jeffbarish at
Wed Sep 1 18:44:31 CEST 2004

Peter Kleiweg wrote:

> Jeffrey Barish schreef:
>> What is the easiest way to beep the console from a Python program
>> (i.e., to do the same thing as echo -e \a)?
> import sys
> sys.stdout.write('\a')
> or if you don't mind a newline:
> print '\a'
I tried this solution before posting my question, but I tried it in the
Idle Python shell.  When I run the command there it outputs \a.  Can
anyone explain why?  I should have tested it from a Python prompt in a
normal window, but I wasn't aware that Idle sometimes gives a different

BTW, it's worth noting that in my program this solution works better


immediately after the write.

Thanks to everyone for the responses.
Jeffrey Barish

More information about the Python-list mailing list