Beeping the console

Dave Reed drlinux at columbus.rr.com
Tue Aug 31 17:49:46 EDT 2004


On Tuesday 31 August 2004 17:31, Jeffrey Barish wrote:
> What is the easiest way to beep the console from a Python program 
(i.e.,
> to do the same thing as echo -e \a)?
> -- 
> Jeffrey Barish


print '\a'

or if you're on a Unix system and the program is not being run from
the console, you can do something like:

con = open("/dev/tty1", "w")
con.write("\a")
con.close()

/dev/tty1 will probably depend on what time of system you're on.

HTH,
Dave





More information about the Python-list mailing list